I think you have to learn to overcome this. It is hard for some people but you must drop the thought that you do something wrong. You can seek the help of others. For example, it might help if you have gay friends who have overcome this where you can see that being gay and having sex is perfectly normal, as some sort of positive role model. You can also join a gay support group. Professional help might also be a choice, depending on where in the world you live.
My boyfriend has a conservative christian background and he still struggles with some aspects of being gay, so I know the problem. But it is getting better as we move along together.