Language:
كتاب التعبير
91  
Interpretation of Dreams
(3)
Chapter: Good dreams are from Allah
(3)
باب الرُّؤْيَا مِنَ اللَّهِ
Sahih al-Bukhari 6985

Narrated Abu Sa`id Al-Khudri:

The Prophet (ﷺ) said, "If anyone of you sees a dream that he likes, then it is from Allah, and he should thank Allah for it and narrate it to others; but if he sees something else, i.e., a dream that he dislikes, then it is from Satan, and he should seek refuge with Allah from its evil, and he should not mention it to anybody, for it will not harm him."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، حَدَّثَنَا اللَّيْثُ، حَدَّثَنِي ابْنُ الْهَادِ، عَنْ عَبْدِ اللَّهِ بْنِ خَبَّابٍ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ، أَنَّهُ سَمِعَ النَّبِيَّ صلى الله عليه وسلم يَقُولُ ‏ "‏ إِذَا رَأَى أَحَدُكُمْ رُؤْيَا يُحِبُّهَا فَإِنَّمَا هِيَ مِنَ اللَّهِ، فَلْيَحْمَدِ اللَّهَ عَلَيْهَا، وَلْيُحَدِّثْ بِهَا، وَإِذَا رَأَى غَيْرَ ذَلِكَ مِمَّا يَكْرَهُ، فَإِنَّمَا هِيَ مِنَ الشَّيْطَانِ، فَلْيَسْتَعِذْ مِنْ شَرِّهَا، وَلاَ يَذْكُرْهَا لأَحَدٍ، فَإِنَّهَا لاَ تَضُرُّهُ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6985
In-book reference : Book 91, Hadith 4
USC-MSA web (English) reference : Vol. 9, Book 87, Hadith 114
  (deprecated numbering scheme)