Sahih al-Bukhari, Hadith 7044

Narrated Abu Salama: I used to see a dream which would make me sick till I heard Abu Qatada saying, "I too, used to see a dream which would make me sick till I heard the Prophet saying, "A good dream is from Allah, so if anyone of you saw a dream which he liked, he should not tell it to anybody except to the one whom he loves, and if he saw a dream which he disliked, then he should seek refuge with Allah from its evil and from the evil of Satan, and spit three times (on his left) and should not tell it to anybody, for it will not harm him. "

حَدَّثَنَا سَعِيدُ بْنُ الرَّبِيعِ، حَدَّثَنَا شُعْبَةُ، عَنْ عَبْدِ رَبِّهِ بْنِ سَعِيدٍ، قَالَ سَمِعْتُ أَبَا سَلَمَةَ، يَقُولُ لَقَدْ كُنْتُ أَرَى الرُّؤْيَا فَتُمْرِضُنِي حَتَّى سَمِعْتُ أَبَا قَتَادَةَ يَقُولُ وَأَنَا كُنْتُ لأَرَى الرُّؤْيَا تُمْرِضُنِي، حَتَّى سَمِعْتُ النَّبِيَّ صلى الله عليه وسلم يَقُولُ ‏ "‏ الرُّؤْيَا الْحَسَنَةُ مِنَ اللَّهِ، فَإِذَا رَأَى أَحَدُكُمْ مَا يُحِبُّ فَلاَ يُحَدِّثْ بِهِ إِلاَّ مَنْ يُحِبُّ، وَإِذَا رَأَى مَا يَكْرَهُ فَلْيَتَعَوَّذْ بِاللَّهِ مِنْ شَرِّهَا، وَمِنْ شَرِّ الشَّيْطَانِ وَلْيَتْفِلْ ثَلاَثًا وَلاَ يُحَدِّثْ بِهَا أَحَدًا فَإِنَّهَا لَنْ تَضُرَّهُ ‏" ‏‏.‏

sunnah.com