Pilate knew Jesus was innocent. He also knew He was more than He appeared. He wanted to let Him go free but the Pharisees insisted Jesus needed to die. Pilate gave into them because they threatened him. The leaders got the people to say to Pilate, "If you release this Man, you are no friend of Caesar; everyone who makes himself out to be a king opposes Caesar."
Freeing Jesus most likely meant death for Pilate. So, he let Jesus.
But, Pilate did one good thing. He had written on Jesus' cross the words, "The King of the Jews" in three languages: Hebrew, Latin and Greek.
In verse 20 it says "Therefore this inscription many of the Jews read, for the place where Jesus was crucified was near the city;"
Who knows who was moved by those five words. The Pharisees weren't happy with this. they told Pilate he should change the words to "He said I am the King of the Jews" but Pilate refused to change it. I think he knew the truth and he did what he could. His weakness wouldn't allow him to do anything else but he did write truth that many would see.