Praise be to Allaah.
There is no doubt that homosexuality and lesbianism are forbidden, as mentioned in the question, and doing these actions is a major sin which deserves the wrath of the Lord and His painful punishment. The Lawgiver is wise and does not forbid anything to people unless it is harmful and damaging to them in this world and in the Hereafter. As far as merely thinking about such sins is concerned, a person will not be punished for that, so long as he does not do it or talk about it, as the Prophet (peace and blessings of Allaah be upon him) said: “Allaah will forgive my Ummah for whatever crosses their minds, so long as they do not act upon it or speak about it.
But thinking a lot about something could lead to a person doing it; at the very least it distracts a person from thinking about something useful that he could do. The scholars of Islam used to call for reform of one’s thinking and striving against bad thoughts, because they may gradually lead one to disastrous consequences. The “doctor of the hearts” Ibn al-Qayyim (may Allaah have mercy on him) said:
“Ward off passing thoughts, for if you do not, they will become ideas. Ward off ideas, for if you do not, they will become desires. Fight them, for if you do not, they will become resolve and determination, and if you do not ward them off, they will become actions. If you do not resist them with their opposite, they will become habits and it will be difficult for you to get rid of them.” (Al-Fawaa’id by Ibn al-Qayyim, p. 33).
The way to repent is clear: give up the sin immediately; regret what has happened; resolve never to go back to it; do a lot of good deeds, for they wipe out bad deeds; keep away from the people with whom you used to commit this sin and shun them if they do not repent; keep away from bad company and everything that calls you to this sin. And Allaah will accept the repentance of those who repent to Him.
Sheikh Muhammed Salih Al-Munajjid