Daniel Kawczynski, MP for Shrewsbury and Atcham, said he also tried to 'train his brain' so he did not feel an attraction towards other men.
Mr Kawczynski, who announced he would be entering into a civil partnership with his long-term partner in November, led a debate he had called in Westminster Hall yesterday.
The MP, a committed Catholic, also told MPs how he had prayed that the train to Shrewsbury would break down as he prepared to reveal to his constituency party that he was in a relationship with another man back in 2013.
Mr Kawczynski called the debate on education in schools regarding the acceptance and understanding of gay, lesbian, bisexual and transgender people.
He said he felt moved call the debate following demonstrations by parents in Birmingham against teaching about homosexuality and transgenderism in schools. He said his parliamentary researcher had also told him about a friend who had been troubled about revealing his sexuality.
Mr Kawczynski told the meeting: "Some young people have confidence and convictions in themselves to set that aside and say 'I'm gay and I'm proud' from a very young age.
"Other people don't have that confidence, they hide what they are and who they are, they hide under rocks or under stones, they will not speak out and because they are fearful of the consequences for them and their families.
"As a young person I went as far as trying to train my own brain into thinking I was straight.
"You do it over and over again, you pray to God that you won't have these strange feelings, you pray that you will be heterosexual and have an interest in women."
Mr Kawczynski said he had been touched by the support he had received since publicly coming out about his sexuality.
He also spoke about a deeply religious Protestant couple from Condover who he met during the vote on same-sex marriage, which was introduced by David Cameron's government in 2014.
"We had lunch in the House of Commons, their son had been to Shrewsbury School, and he had gone on to become a doctor in Manchester," he said.
"They said to me 'you have to vote for equal marriage, because I don't want my son to be living in sin'. That will stay with me forever."
Mr Kawczynski said he understood the concerns of the parents in Birmingham who were protesting at LGBT classes in their children's schools.
"I respect the rights of those parents outside those schools in Birmingham to demonstrate," he said.
"Nobody wants children to have overtly sexual things in schools at an inappropriately young age.
"This is a very difficult matter, and has to be treated with a huge amount of sensitivity.
"However, I would appeal to all those protesters, what sort of message does it send out to young LGBT people when they see all the anger and rage and vitriol emanating from them about LGBT issues?
"If they have concerns about LGBT acceptance and education in schools, they ought to come and see the minister, they ought to lobby the Government, they ought to be questioning and probing all the time about how this will be explained.
"But I appeal to them, show some tolerance, show some civility to how vulnerable young people are at that stage, and don't do anything that will have young people thinking they are not worth, or that they are some way unequal.
"I went through that as a young person, and I wouldn't want young people to go through that again."