We’ve addressed all of the thought processes to prevent matters from becoming compulsive behaviours, but it is not a mere mind exercise, just as overcoming the fear of a rollercoaster cannot be achieved by merely thinking about riding it!
When the mind becomes obsessed with a thought, the nafs (self) eventually becomes habituated with a compulsive behaviour to flee the discomfort, and so practical steps are also necessary to end the habituated behaviours.
We will go into some of these steps below.
Islamic exposure therapy
How it works
Exposure therapy is the gold standard in psychological treatment that was developed to help people confront their fears.
When people are fearful of something, they tend to avoid the feared objects, activities, or situations. Although this avoidance might help reduce feelings of fear in the short term, over the long term it can make the fear become even worse.
In this form of therapy, psychologists create a safe environment in which to “expose” individuals to the things they fear — and avoid — in order to break the pattern of avoidance.  These exercises have been proven to gradually reduce anxiety in those with OCD.
Two examples pertaining to wudū
Keeping regular records to reduce worry
One intervention could be to create a log.
This works between therapists and patients, husbands and wives, and so on, where the patient carries out, for example, wudū in front of their assistant, and keeps a log of the time taken for completion, with the objective of incrementally reducing the time on each occasion.
So, on Monday, making wudū took 15 minutes. By next week, we aim to make the wudū 10 minutes long, and so on, whilst discouraging them from repeating the wudū.
They could also be encouraged to perform the basic wudū, avoiding the Sunan (optional components), for a period of time. Then, when that phase is complete, the Sunan can be gradually reintroduced.
Fear that you pass urine post-wudū?
Another intervention could be, for those who worry about releasing droplets of urine post-wudū, the splashing of some water onto the private parts and/ or underwear after wudū.
A man approached Imam Ahmad and asked,
“I carry out my wudū and purify myself, but feel that I have lost my wudū thereafter.” 
Imam Ahmad advised him,
إذا توضأت فاستبرئ ثم خذ كفا من ماء فرشه على فرجك ولا تلتفت إليه فإنه يذهب إن شاء الله
“Ensure that you are clean after performing wudū, then splash some water onto your private parts. After that, do not look back, for it will go, if Allah wills.” 
Limitations for Muslim clinicians
Though the exposure therapy model is an effective model and is, to some extent, compatible with the Islamic approaches to al-Wiswās al-Qahri, Muslim clinicians are to be mindful when applying such techniques, due to their limitations.
For example, one who suffers from blasphemous thoughts cannot be encouraged to tear apart the mushaf as part of exposure therapy.
Similarly, a person who has an irrational fear of getting something nājis (impure) on their body cannot purposely put impure things on their body during prayer, or ignore something they know with complete certainty to be impure, as this would invalidate the prayer.
Islamic objective measures
Objectivity over subjectivity
Our religion has given us objective measures to work with.
The Prophet ﷺ said,
إِذَا وَجَدَ أَحَدُكُمْ فِي بَطْنِهِ شَيْئًا فَأَشْكَلَ عَلَيْهِ أَخَرَجَ مِنْهُ شَيْءٌ أَمْ لَا فَلَا يَخْرُجَنَّ مِنَ الْمَسْجِدِ حَتَّى يَسْمَعَ صَوْتًا أَوْ يَجِدَ رِيحًا
“If any of you senses a disturbance in his abdomen and doubts whether or not he has released something, he should not leave the mosque unless he hears a sound or perceives a smell.” 
And he ﷺ also said,
لَا وُضُوءَ إِلَّا مِنْ صَوْتٍ أَوْ رِيحٍ
“No ablution is necessary, except when one makes a sound or breaks wind.” 
Notice how these narrations shift people from sensations and subjectivity to perceptible matters and objectivity.
Doubts about the number of raka’āt performed
Similarly, the Prophet ﷺ said,
إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ، فَلَمْ يَدْرِ كَمْ صَلَّى ثَلَاثًا أَمْ أَرْبَعًا، فَلْيَطْرَحِ الشَّكَّ وَلْيَبْنِ عَلَى مَا اسْتَيْقَنَ، ثُمَّ يَسْجُدُ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ، فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعْنَ لَهُ صَلَاتَهُ، وَإِنْ كَانَ صَلَّى إِتْمَامًا لِأَرْبَعٍ كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ
“When one of you is in doubt about his prayer, and does not know how much he has prayed, three or four raka’āt, he should pray one (additional) raka’ah and make two prostrations while sitting before giving the salutation.
“If the (additional) raka’ah which he prayed is the fifth one, he will make it an even number by these two prostrations. If it is the fourth one, the two prostrations will be a disgrace for the devil.” 
al-Nawawī said of the above,
Targhīman (disgrace) of Shaytān is a way of annoying and humiliating him, as well as rejecting him as a result of his failure to achieve his desire of disturbing the worshipper. 
Separating Nafsāni thoughts from Shaytāni ones
From an Islamic perspective, waswasa can come from either the nafs, or from external forces like Satan.
The Prophet ﷺ would say in his du’ā seeking help from Allah against both sources of whisperings:
اللهم عالم الغيب والشهادة فاطر السموات والأرض رب كل شيء ومليكه، أشهد أن لا إله إلا أنت، أعوذ بك من شر نفسي، ومن شر الشيطان وشركه
“O Allah, Knower of the unseen and the seen, Maker of the Heavens and the Earth, Lord of everything and its Master, I bear witness that there is none worthy of worship but You.
“I seek refuge in You from the evil of my soul, and from the evil of Satan and his calls to disbelief.” 
Our belief as Muslims is that the latter is a metaphysically distinct creature of an evil nature that Allah, in His perfect wisdom, brought into existence and flows through man like the flowing of blood. 
Which thoughts are our own and which are from the Devil?
The danger arises with our tendency to conflate Satan and ourselves, particularly whenever we say “I this” or “I that”.
Much of what we claim as being our thoughts are, in actual fact, not our thoughts.
Rather, they are the whisperings of Shaytān. And he has an ability to hide his suggestions behind the veil of “I”.
As numerous thinkers and authors have put it,
“The greatest trick the devil ever pulled was convincing the world he didn’t exist.”
This singular realisation is critical as it interrogates the cause of these thoughts.
The fruits of knowing this is the decoupling from examples such as the following:
|My thoughts?||Or do they originate from Shaytān?|
|“I have left the fold of Islam.”||“No, you [Shaytān] have left the fold of Islam and, being my enemy, you wish to convince me that I have as well.”|
|“My wudū is invalid.”||“No, Shaytān is trying to convince me that my wudū is invalid.”|
|“I am worthless.”||“I am not worthless, but Shaytān is hiding behind the first-person narrative and causing doubts.”|
Because our individual Shaytān has been part of our life’s journey since inception, we’ve grown accustomed to his whisperings, such that we are unable to differentiate between his whisperings and our own thoughts!
A paradigm shift
The realisation that the source of your darkest thoughts is not yourself is life changing and both an intensely and immediately liberating experience, enabling one to break free from the tyranny of “I believe…”, “I think…”, “I doubt…”, due to the realisation that “It’s not me thinking this, so it doesn’t have to be true.”
It’s similar to hearing someone shouting at you in the street, “Oi, terrorist!” Whilst this may cause pain, it will not cause one to doubt one’s true status, because it has come from a hateful external source.
Similarly, the whisperings of Shaytān are from a hateful external source. 
Questions and answers
Q: How can I tell the difference between the whisperings of Shaytān from that of my own self?
A: Abu Hāzim said,
ما كَرِهَتْه نفسُك لنفسك فهو من الشيطان فاستعذ بالله منه، وما أحبته نفسك لنفسك فهو من نفسك فانهها عنه
“Whatever your inner self hates for itself, it is from the Shaytān, so seek refuge with Allah from it.
“And whatever your inner self likes for itself, then it is from your inner self, so forbid it from it.” 
I.e., the nafs‘ whisperings are usually for things that are connected to its whims and desires, whereas Shaytān’s whisperings are usually for things that one dislikes, such as a prompt that leads to doubt in Allah, purity, etc. 
Q: If that is the case, then why does Isti’ādha (seeking refuge) from Shaytān not always bring about an immediate cessation of intrusive thoughts, where patients may require long periods of therapy?
A: This is because, what may have started as a Satanic whispering was acted upon again and again, until the nafs habituated a particular response to a fear over a long period of time.
It eventually became accustomed to it (with strong impressions left on the nafs), therefore the undoing of this process is more drawn out. So, clearly there is interplay between the two; Shaytān plays and preys on people’s inner vulnerabilities.
So, if one has a propensity towards fear, perfection, catastrophising, or their likes, Shaytān will seek to exploit them, and it is our responses that dictate whether these Satanic promptings are expelled there and then, or reinforced until they’re given a home within the nafs.
Work on your “self”
al-Ghazāli suggests the intervention of closing the internal pathways that Shaytān may use by working on one’s self.
The stronger one becomes internally, the tighter these pathways become, and so, even if they do not close (which, as we suggested, is possible), Shaytān’s whisperings will be reduced to inconsequential background noise.
Remember, Shaytān’s influence upon Muslims and their dhikr, Isti’ādha, purity, and repentance is far weaker than it is on others, as Allah says,
إِنَّهُۥ لَيْسَ لَهُۥ سُلْطَـٰنٌ عَلَى ٱلَّذِينَ ءَامَنُوا۟ وَعَلَىٰ رَبِّهِمْ يَتَوَكَّلُونَ
“He [Satan] certainly has no authority over those who believe and put their trust in their Lord.” 
Shifting anxiety away from the first act of worship
Prayers, for example, are repeated as a result of fearing the deficiency of the first prayer.
This intervention is about shifting the anxiety from the first prayer to the repeated prayers, hence reducing the incentive to repeat them.
So, we ask the person,
“Why did you carry out the first prayer?”
(S)he will respond,
“Because Allah instructed me to do so.”
Then (s)he is to be asked,
“So, why did you carry out the second, third, fourth prayer?”
They will respond,
“Because I doubted the prayer.”
Then they’re asked,
“Where did this idea come from?”
(S)he will (should) respond,
Then they are asked,
“So, if your first prayer was carried out in obedience to Allah, who was the second prayer in obedience to?”
In this case, the therapist is shifting the anxiety from the first prayer onto the repeated prayers, thereby disincentivising him or her from repeating it.
To summarise, the purpose of these measures ultimately boils down to one matter, to reduce anxiety surrounding unworthy matters.
Anxiety is a driving force behind Obsessive Compulsive Disorder, so if you are not anxious about the thoughts, you’ll notice a significant reduction in the attacks.
“You cannot prevent the birds of sorrow from flying over your head, but you can prevent them from building nests in your hair.” 
The goal, therefore, is not to eliminate the thought but to conquer it, such that it has no control over you. 
- OCD can cause great harm, so seek to defeat it while acknowledging that it can't be totally eliminated.
- Use objective Islamic measures, including Prophetic guidelines, to identify Nafsāni vs. Shaytāni whispers.
- Strengthen one's internal self to reduce the influence of both kinds of whisperings.
 Muslim, on the authority of Abu Hurayrah; https://sunnah.com/muslim:362
 Ahmad, on the authority of Abu Hurayrah; https://sunnah.com/mishkat:310
 Muslim, on the authority of Abu Sa’īd al-Khudri
 Sharh Muslim
 Abu Dāwūd, on the authority of Abu Hurayrah; https://sunnah.com/hisn:109
 al-Bukhāri and Muslim, on the authority of Anas
 Adapted from the works of Dr. Asim Yusuf; https://www.youtube.com/watch?v=IkD8ged2Sfc
 Majmū’ al-Fatāwa
 Some of the scholars pointed out another important difference, which is that the waswasa that comes from the Shaytān makes sin appear attractive until the Muslim falls into it.
If the Shaytān is unable to achieve that, he moves onto another sin, and if that does not work, he moves onto a third, and so on.
He does not care about making the Muslim fall into a particular sin; rather, what he cares about is making the Muslim disobey his or her Lord, and it is all the same to him whether he makes them do something that is forbidden or omit something that is obligatory, for all of it is sin and disobedience.
As for the waswasa that comes from the nafs, it is what urges the person to commit a specific sin and repeatedly seeks to make him do it.
 al-Qur’ān, 16:99
 I benefited from Dr. Hooman Keshavarzi’s presentation — a licensed psychotherapist who holds a Doctorate in Clinical Psychology — which can be accessed via: https://www.youtube.com/watch?v=XGZjuIKwuaY