All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Dear brother, accept the true religion of Islam and embrace it as soon as possible. Know that only by accepting Islam that Allah will wipe out all your past sins, no matter how big or grave they were, whether it is homosexuality or anything else.
Allah Says in the Quran (what means): {Say to those who have disbelieved [that] if they cease, what has previously occurred will be forgiven for them.} [Quran 8:38]
If you accept Islam, Allah will take care of you, protect you and bless you to avoid this bad practice which was known in the nation of the Prophet Loot and Allah destroyed it all by a severe torment. Allah raised it to the sky and then threw it upside down to the earth.
We advise you to do the following to get rid of this evil.
1. Keep reminding yourself of the punishment, which afflicted the people of Loot .
2. Hasten to marry since marriage helps one to protect his private parts and to lower his gaze from forbidden things.
3. Remind yourself also of the bad diseases carried by this practice.
4. The main and most important factor that will make you avoid this evil habit is to keep in mind that Allah Almighty is always watching you and He is Aware of all your deeds and acts.
5. Check Islamic websites for advice.
For more benefit on the prohibition of homosexuality, please refer to Fataawa 82048, 89290 and 92704.
Allah knows best.