264 — “When you retire to your bed, say: ‘I seek refuge in the perfect words of Allah from His wrath and His punishment, from the evil of His servants, from the promptings of the devils, and from their presence.’”
Ibn al-Sunni transmitted it (no. 238) by way of Abu Hisham al-Rifaʿi: Wakiʿ ibn al-Jarrah narrated to us; Sufyan narrated to us from Muhammad ibn al-Munkadir, who said:
“A man came to the Prophet, peace and blessings be upon him, and complained to him of terrifying things he saw in his dreams. He said…” and then cited it.
I say: The narrators in this chain are trustworthy, apart from this Abu Hisham, whose name was Muhammad ibn Muhammad ibn Yazid al-Rifaʿi al-ʿIjli. Al-Dhahabi said in al-Duʿafaʾ (“The Weak Narrators”):
“Al-Bukhari said: ‘I found them unanimous in declaring him weak.’”
ʿUthman ibn Abi Shaybah accused him of stealing the hadiths of others and then narrating them falsely. See al-Tahdhib.
If this is so, then perhaps the basis of the hadith is what Musaddad narrated: Sufyan ibn ʿUyaynah narrated to us from Ayyub ibn Musa, from Muhammad ibn Muhammad ibn Yahya ibn Hibban:
“Khalid ibn al-Walid, may Allah be pleased with him, used to suffer from insomnia—or was afflicted by insomnia—and complained of it to the Prophet, peace and blessings be upon him. He instructed him, when going to sleep, to seek refuge in the perfect words of Allah…”—the hadith.