Abu Saeed Khudri reported,

He heard the Messenger of Allah ﷺ say, "When one of you sees a dream that he likes, it is only from Allah, so let him praise Allah for it and speak of what he saw. But when he sees something other than that which he dislikes, it is only from Satan, so let him seek refuge with Allah from its evil and not mention it to anyone, for then it will not harm him."

Tirmidhi 3453

Sahih

حدثنا قتيبة بن سعيد حدثنا بكر بن مضر عن ابن الهاد عن عبد الله بن خباب

عن أبي سعيد الخدري

أنه سمع رسول الله ﷺ يقول إذا رأى أحدكم الرؤيا يحبها فإنما هي من الله فليحمد الله عليها وليحدث بما رأى وإذا رأى غير ذلك مما يكرهه فإنما هي من الشيطان فليستعذ بالله من شرها ولا يذكرها لأحد فإنها لا تضره

الترمذي 3453صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Supplications
Chapter
What to say when one sees a dream he dislikes
Numbering
Darussalam 3453
Tirmidhi 3453