Abdullah bin Abbas reported,

A man came to the Prophet ﷺ and said, "Messenger of Allah, one of us finds something stirring in his soul, alluding to a matter so grievous that he would rather be reduced to charcoal than utter it."The Prophet ﷺ replied, "Allah is the Greatest, Allah is the Greatest, Allah is the Greatest. Praise be to Allah who has reduced his scheme to mere whispering."Ibn Qudamah said, "his affair" instead of "his scheme."

Abu Dawud 5112

Sahih

حدثنا عثمان بن أبي شيبة وابن قدامة بن أعين قالا حدثنا جرير عن منصور عن ذر عن عبد الله بن شداد

عن ابن عباس قال

جاء رجل إلى النبي ﷺ فقال يا رسول الله إن أحدنا يجد في نفسه يعرض بالشيء لأن يكون حممة أحب إليه من أن يتكلم به فقال الله أكبر الله أكبر الله أكبر الحمد لله الذي رد كيده إلى الوسوسة قال ابن قدامة رد أمره مكان رد كيده

أبو داود 5112صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Manners
Chapter
Repelling satanic whispers
Numbering
Darussalam 5112
Abu Dawud 5112