In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- Adultery (zina) is one of the biggest sins and its punishment in the Shari`ah is severe if one who committed it does not repent and expiate his sin.
2- In your case, you are highly recommended to make quick and sincere repentance and take quick steps to return to Allah doing good deeds and asking Allah Almighty to forgive you.
3- We also urge you not to abandon your prayers; rather you should keep practicing and perform more optional prayers (nawafil) especially at night (tahajjud).
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
The first step, for you, is to take by way of redeeming yourself, is to recognize the enormity of your sin.
You have been guilty of a double sin; firstly, you committed adultery (zina) which itself is a grave sin. Secondly, you have violated the sanctity of the month of Ramadan.
Therefore, you must never look at it lightly; rather you need to take immediate steps to seek repentance and return to Allah.
Repentance, however, is not simply saying, I am sorry; it takes tangible steps. Repentance is not complete unless you do whatever is necessary to redeem yourself and expiate for your sins.
Expiation for breaking a single fast in Ramadan through sexual intercourse entails fasting sixty days; if one cannot do so, then he or she needs to feed sixty poor persons.
You ought to remember the above expiation is due in case of sexual intercourse with one’s own wife; your case is even worse.
So, you need to recognize the enormity of the sin you have committed.
You need to feel deep remorse about it and resolve in your mind never to do it again.
You should also take immediate steps to move away from such a life-style.
I urge you to utilize the month of Ramadan to cleanse and purify yourself.
Here are some tips for you to follow:
1- Spend as much time as possible in the mosque and in the company of people who are Allah-fearing.
2- Pray in congregation, especially Fajr and `Isha’ as diligently as you can.
3- Attend the Taraweeh prayers in the mosque.
4- Listen to inspirational talks and lectures; there is no shortage of them if you are willing to look around.
5- Make friends with pious and practicing Muslims of your age group and hang around with them.
6- Read a portion of the Qur’an every day.
7- Practice dhikrand cry to Allah and beg for His mercy as often as you can. You may also do well to get a copy of The Invocation of God by Ibn al-Qayyim and apply its lessons.
Allah Almighty knows best.
Excerpted with slight modification from, askthescholar.com