1179 - حَدَّثَنَا الْحُمَيْدِيُّ قَالَ: ثنا سُفْيَانُ، قَالَ: ثنا أَيُّوبُ، عَنْ مُحَمَّدٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّي اللهُ عَلَيْهِ وَسَلَّمَ: «إِذَا رَأَي أَحَدُكُمْ رُؤْيَا يَكْرَهُهَا، فَلْيُصَلِّ رَكْعَتَيْنِ، وَلَا يُخْبِرْ بِهَا أَحَدًا، فَإِنَّهَا لَنْ تَضُرَّهُ»
Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates: The Noble Prophet (peace and blessings be upon him) said: "When a person sees a dream that he does not like, he should perform two rak‘ahs and not tell anyone about that dream, then that dream will not harm him."
Related hadith on this topic