How to Deal with Compulsive Whispers in Islam
Question

I suffer from compulsive Waswas (Satanic whispers), especially during prayer and when I am on my own. The kind of Waswas that I have is swearing and cursing, which I cannot help saying, such as cursing myself or my father or my mother.
I hope that you can tell me the right way to deal with this, and pray for me. May Allah reward you with good.
Praise be to Allah.Compulsive Waswas (OCD) is a kind of sickness, and the one who is affected by it should treat himself in a number of ways: 
·         Turning to Allah and beseeching Him, for He answers the one who is in distress if he calls upon Him, and grants him relief. So, let him say what Ayyub (peace be upon him) said: 
And [mention] Job, when he called to his Lord, "Indeed, adversity has touched me, and you are the Most Merciful of the merciful." (Al-Anbiya’ 21:83)
And the Prophet (peace and blessings of Allah be upon him) said: “Allah has not sent down any disease but He has also sent down its cure. Those who know it, know it, and those who do not know it, do not know it.” (Narrated by Ahmad, classed as sound by Al-Albani in Ghayat Al-Maram)
So the cure comes from Him, and healing is in His Hand, so beseech Allah and make the most of the time before dawn, for Allah descends every night to the lowest heaven when the last third of the night is left, and He says: “Who will call upon Me, that I may answer him? Who will ask of Me, that I may give to him? Who will seek My forgiveness, that I may forgive him?” (Narrated Al-Bukhari and Muslim) 
·         Turning away from Waswas and what it calls you to, and distracting yourself from it by keeping busy with worship and acts of obedience as much as possible. Hence the Prophet (peace and blessings of Allah be upon him) told the one who was affected by Waswas: “Let him seek refuge with Allah and stop (such thoughts).” (Narrated by Al-Bukhari and Muslim) 
If the urge to swear and curse comes, then seek refuge with Allah from the accursed devil, and keep yourself busy with remembrance of Allah and glorifying Him, or raise your voice reciting Quran, or speak to your friend, and so on. 
·         Remember Allah a great deal (Dhikr), especially by praying for forgiveness, for Waswas comes from the devil or he has some involvement in it, but when Allah is mentioned he slinks away or flees. Allah says (interpretation of the meaning): 
And if there comes to you from Satan an evil suggestion, then seek refuge in Allah. Indeed, He is the Hearing, the Knowing. (Fussilat 41:36) 
Ibn Kathir (may Allah have mercy on him) said in his Tafsir (exegesis): 
“With regard to the devil among the jinn, there is no way to ward it off if he whispers except to seek refuge with his Creator Who has allowed him to gain power over you. If you seek refuge with Allah and turn to Him, He will restrain him and foil his plot. When the Messenger of Allah (peace and blessings of Allah be upon him) stood up to pray he would say: “I seek refuge with Allah, the All-Hearing, All-Knowing, from the accursed satan, from his whisper, his arrogance and his poetry.” 
Muslim narrated that `Uthman ibn Abu Al-`As (may Allah be pleased with him) came to the Prophet (peace and blessings of Allah be upon him) and said: “O Messenger of Allah, the devil has interfered with my prayer and made my recitation confused.” The Messenger of Allah (peace and blessings of Allah be upon him) said: “That is a devil called Khanzab. If you experience that, then seek refuge with Allah from him, and spit drily to your left three times.” He said: I did that, and Allah took it away from me. 
And the advice that Yahya (peace be upon him) gave to his companions was: “I enjoin you to remember Allah, for the likeness of that is of a man who was pursued by the enemy, until he came to a strong fortress where he found protection from them. Similarly, a person cannot protect himself from the devil except by remembering Allah.” (Narrated by At-Tirmidhi, classed as authentic by Al-Albani in Sahih At-Tirmidhi) 
·         Going to a trustworthy Muslim doctor, for this Waswas is a kind of sickness, as stated above. The Prophet (peace and blessings of Allah be upon him) said: “Seek medical treatment, for Allah has not created any disease but He has also created a cure for it, except for one disease: old age.” (Narrated by Ahmad, Abu Dawud, At-Tirmidhi, 2038; Ibn Majah; classed as authentic by Al-Albani in Sahih Abu Dawud) 
·         You should note that whoever is afflicted with this sickness is excused for what he says, because he does not say it willingly and he does not like it. Rather he will be rewarded, in sha Allah, if he bears it with patience and seeks reward. He will be rewarded for hating the Waswas and trying to escape it. Hence when some of the Companions of the Prophet (peace and blessings of Allah be upon him) came and asked him: “We find in ourselves something that is too awful for any of us to speak of it,” he (peace and blessings of Allah be upon him) said: “Do you really find that?” They said: Yes. He said: “That is clear faith.” (Narrated by Muslim, from the Hadith of Abu Hurayrah (may Allah be pleased with him))
An-Nawawi (may Allah have mercy on him) said in Sharh Muslim: 
“What this means is that the fact that you find it too awful to speak of is a sign of clear faith, because finding it too awful to speak of and being afraid of it and of uttering it, let alone believing it, is the sign of one who has achieved true and perfect faith, and who has shed all doubts.” 
We ask Allah to heal you and make you well. 
For more details, please see the following answers: 12315 , 98295 , 72307 , 41027 , and 166379 .
And Allah knows best.