Praise be to Allah.
We must realize that mental illnesses are of varying levels. Some of them are mild and can be treated with behavioural therapy and psychological advice, with no need for medication, and others are more severe, such as schizophrenia and the like. These are the types that require medication.
It is essential to consult a doctor or specialist in psychology, because he will know the best methods that one may commit to in order to change one’s way of thinking and be freed from disorders. He may help you with some effective medication in that regard. So do not hesitate to go to him, for the waswaas [intrusive thoughts] could get worse. You should deal with the problem before it is too late.
It should be noted that there are recent scientific studies which support cognitive behavioural therapy (CBT) and sessions with a specialist in psychology, in the case of social phobia; this is very important and more beneficial than medication alone.
With regard to compulsive intrusive thoughts, especially in advanced stages, this requires a combination of two things: behavioural therapy and using some safe medications, under the supervision of a specialist doctor.
Please see also the answer to question no. 90819 .
Allah, may He be glorified and exalted, has caused the Holy Qur’an to have a powerful impact on people, refining their character and disciplining them, and also healing them, as He, may He be glorified, says (interpretation of the meaning):
“Say, ‘It is, for those who believe, a guidance and cure’” [Fussilat 41:44]
“And We send down of the Qur'an that which is healing and mercy for the believers” [al-Isra’ 17:82].
This applies especially to Soorat al-Baqarah, from which the Shaytaan flees. So we should be keen to recite it and to recite the adhkaar which are prescribed to protect the Muslim.
There is no reason why you should not use medication if the doctor recommends using it, as has been noted above, whilst continuing to also seek treatment with the Qur’an. Both are good.
You must have a positive outlook on life; think positively of Allah, may He be glorified and exalted; set things straight between you and Him, may He be glorified; and persist in calling upon Him in supplication (du‘aa’) and asking Him to relieve your distress and worries. Never despair of His mercy, trust in Him, and be certain that He is with you and will never forsake you, for Allah is as His slave thinks He is. Do not get carried away with this waswaas; ignore it, for that is an important means of healing from it.
May Allah guide you and grant you complete healing and well-being.
And Allah knows best.