Mashallah, you have built an awareness of yourself, found the courage to recognize a bad habit and have begun to take serious steps to eradicate it. Your actions are commendable, indeed, for they show your commitment to the Obedience and Pleasure of Allah (swt).
These efforts, no matter how discouraging or frustratingly slow they may seem, will surely count on the scale of deeds on the Day of Judgement for Allah swt promises in the Holy Quran “So, whoever has done an atom's weight of good shall behold it” (Sura Zilzal 99:7)
The dreams you refer to are actually an encouraging sign and, in fact, an indication that your abstinence is having an effect on your system. The field of psychology sees dreams as often a reflection of our hidden or repressed thoughts, struggles, fears and anxieties. These dreams are proof that your self-restraint has been prolonged enough to result in withdrawal symptoms. These phenomenon are not only expected in addiction recovery, but are also a warning sign that this is not the time to give up; rather it is a time to brace yourself with added vigour, strength and conviction. Victory is very near, inshallah.
When the human body has become accustomed to receiving gratification in a specific way, it is only expected that changing and unlearning these patterns will result in a fair amount of internal turmoil, anguish, struggle and, unfortunately, relapse.
At such times, Shaitan, the eternal Accursed opportunist, looks for the weakening of the soul, the cracks in the armour, so to speak, and encourages one to give in just one more time. But giving in just once is never a good idea and can take one to a deeper place of obsession.
In the field of the study of addictive behaviours, such relapses are referred to as binges; just one more cigarette, just one glass of alcohol, just one more piece of cake, just one more immoral act actually leads to a thousand more, often in one sitting.
Undoubtedly, it is not easy to give up any type of addiction whether it means abstaining from a forbidden act, withdrawing from a friend who is toxic, giving up carbohydrates and heavily reducing food intake, avoiding backbiting, breaking off an immoral relationship, quitting gambling or deciding to stop substance abuse such as smoking, alcohol or drugs. Even giving up a seemingly benign habit such as nail-biting or thumb-sucking can often take years to truly stop.
Perhaps this is why so many who struggle with addictions will often plead to others to never allow themselves to start a bad habit in the first place.
The human body and mind is susceptible and prone to addiction and this is why Islam encourages self-discipline and restraint from an early age, and alerts us to the vulnerability of the nafs ul amara (the lowest, base part of the human soul) which the accursed Shaitan cunningly befriends and entices.
Nevertheless, eradicating an addiction is completely possible and the success stories are all around us. In fact, even life-long chain-smokers have been able to give up smoking overnight; the phenomenon is called “going cold-turkey”.
Unfortunately, most of such drastic changes have been known to happen when the individual has been given a terminal diagnosis and is told they do not have too long to live. At that stage, one could argue, giving up the addiction is futile. And yet the one facing death, in sheer desperation, will do it anyway.
Thus, those such as you, who realize the seriousness of the matter early and work proactively to quit a serious addiction before it is too late and those who actually are successful at beating the addiction are the ones who truly deserve accolades.
Their steadfastness and resilience, their ability to remain true to their own promise to their nafs is a testament to the strength of the human spirit of being able to put mind over matter. To understand how addiction works it is important to read as much as possible on the subject.
For more information, refer to the following articles on the cycles of withdrawal and tolerance, guilt and justification in addictive behaviours:
Understanding relapse as a normal process of addiction recovery: https://www.verywellmind.com/what-is-relapse-22106
The key to giving up an addiction is a combination of firm and serious resolve combined with active efforts to uphold the new lifestyle, distracting oneself and to engage in acts of worship to strengthen the process.
Doing this will inshallah discourage compulsive thoughts and recurrent dreams and lessen the withdrawal symptoms until one is completely free of the addiction, inshallah.
Start with regular and timely offering of the daily salaah as this helps to build an armour against Shaitaan, the accursed.
Imam Jaffer Sadiq (a.s) advises, “Shaitaan fears man as long as he offers his salaat five times in its prime time. When the person wastes these salaat, Shaitaan gets bold and involves that person in greater sins.”
In addition to this, the offering of Salaat ul Layl is extremely beneficial in upholding this armour and keeping oneself in a continual state of worship. Night time can also become a time of loneliness when idle and obsessive thoughts can lead to a relapse; thus keeping oneself distracted in worship at night is a good strategy.
Salatul Layl not only evokes blessings and forgiveness from Allah (swt) but it also helps to create self-awareness about the destructive nature of sins and to keep oneself cleansed as one works towards a new sin-free lifestyle.
For a step-by-step guide on how to recite salatyl layl: http://www.duas.org/tahajjud.htm
Additionally, there are some beautiful duas that are highly recommended after Salatul Layl which truly enhance the experience of worshipping in the loneliness of the night as the Beloved listens to our plea in Dua Hazeen:
I whisper unto You O One Who is present in every place so that You may hear my call for surely my sin is excessive and my shame is less
اُنَاجِیْکَ یَا مَوْجُوْدًا فِیْ کُلِّ مَکَانٍ لَعَلَّکَ تَسْمَعُ نِدَآئِیْ فَقَدْ عَظُمَ جُرْمِیْ وَ قَلَّ حَیَآئِیْ
I call for help and I call for help, O Allah from desires which have overpowered me and from the enemy which has pounced on me and from the world which attracts me and from the soul that leads towards evil except that on which my Lord has mercy (12:53)
مَولاَیَ یَا مَوْلاَیَ حَتّٰی مَتٰی وَ اِلٰي مَتٰي اَقُوْلُ لَکَ الْعُتْبٰی مَرَّۃً بَعْدَ اُخْرٰی ثُمَّ لاَ تَجِدُ عِنْدِیْ صِدْقًا وَ لاَ وَفَآءً فَیَاغَوْثَاہُ ثُمَّ وَاغَوْثَاہُ بِکَ
Dua Hazeen: https://www.duas.org/Misc/dua_e_hazeen.htm
Recitation of Dua Komail on Thursdays is an important part of this process towards reducing withdrawal symptoms when recovering from an addiction.
It is crucial to accompany acts of worship with reading material that can enhance one’s understanding of how sins can destroy our faith. Allama Dastghaib Shiraz’s book, “Greater Sins” (3 volumes) is an especially informative look at the destructive nature of sins on the human soul.
The book includes a 2 part section on tawba which is also very inspiring: https://www.al-islam.org/greater-sins-volume-1-ayatullah-sayyid-abdul-hu...
Complement such reading of books and articles with video and audio lectures on “astagfar” to not only firm your resolve to not sin again but to also give you reassurance that Allah swt is Al-Ghafir (the forgiver) al-Ghafur (most forgiving) Al Ghaffar (oft forgiving).
Engage in a healthy and very active lifestyle to distract yourself from the addictive behaviour in question.
Join a sports team, exercise regularly, keep a busy social schedule, volunteer and visit your Islamic centre regularly.
Continue on this commendable and most necessary task of giving up the forbidden act that you are struggling with.
And never underestimate the power of Allah swt in blessing and making what seems an impossible task, completely possible.
Allah swt not only praises those that strive for His forgiveness but promises that He swt will, in fact, turn their evil deeds into good ones.
“Except him who repents and believes and does a good deed; so these are they of whom Allah changes the evil deeds to good ones; and Allah is Forgiving, Merciful. And whoever repents and does good, he surely turns to Allah a (goodly) turning.” (Surah Furqān 25:70-71)
Dreams are not within our power to control and Allah swt does not hold us accountable for them. Feeling guilty is not helpful but engaging in these helpful strategies and acts of worship will inshallah lessen the occurrence of these dreams.
May Allah swt give you the strength, courage, conviction and resilience of faith and imaan, to free yourself of this addiction.
With continued efforts and the blessings of Allah swt, inshallah, the disturbing dreams and recurrent thoughts will soon become completely rare and non-existent. Ilaahi ameen