It was narrated from Jabir that the Messenger of Allah ﷺ said: "If anyone of you has a bad dream, he should not tell people about how Satan played with him in his dream".
The Prophet Muhammad ﷺ also taught us that if we have a bad dream, we should seek refuge in Allah ï·» from its evil by saying “A’udhu billahi minash-shaitanir-rajeem” which means “I seek refuge in Allah from the accursed Satan” three times before going back to sleep. This will help protect us from any further harm caused by the devil or his influence in our lives.