عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ رَضِيَ اللَّهُ عَنْهُ أَنَّهُ سَمِعَ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يَقُولُ إِذَا رَأَى أَحَدُكُمُ الرُّؤْيَا يُحِبُّهَا فَإِنَّمَا هِيَ مِنَ اللَّهِ فَلْيَحْمَدِ اللَّهَ عَلَيْهَا وَلْيُحَدِّثْ بِهَا فَإِذَا رَأَى غَيْرَ ذَلِكَ مِمَّا يَكْرَهُ فَإِنَّمَا هِيَ مِنَ الشَّيْطَانِ فَلْيَسْتَعِذْ بِاللَّهِ مِنْ شَرِّهَا وَلَا يَذْكُرْهَا لِأَحَدٍ فَإِنَّهَا لَا تَضُرُّهُ
Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: When any of you sees a dream, if it is pleasing, then it is from Allah Almighty; he should praise Him for it and he may relate it to others. But if he sees any other dream which he dislikes, then it is from Satan; he should seek refuge with Allah Almighty from its evil and should not mention it to anyone, it will not harm him.