Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How can I rid myself of satanic whisperings (waswasah) and evil thoughts?
You do this firstly by ignoring them, seeking refuge in Allah from them and pleading with Him to rid you of them. You must then make Allah’s remembrance dominate your heart by striving to be present and focusing your thoughts on the meaning of the remembrance and the greatness of the One Whom you are remembering.
You should recite:
Surat al-Nas eleven times in the morning and evening
181 times a day:
Also repeat the name of Allah, elongating the “a” – “Allaaah.” You can do this while raising your head to the sky.
Try to turn your thoughts in a different direction. Try to contemplate Allah’s majesty and our journey unto Him, His bounties and His signs in creation. Bestowing abundant peace and blessings on the Prophet Muhammad ﷺ will help in this.