Mishkat al-Masabih 1219
عَنْ أَبِي هُرَيْرَةَ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم قَالَ: يَعْقِدُ الشَّيْطَانُ عَلَى قَافِيَةِ رَأْسِ أَحَدِكُمْ إِذَا هُوَ نَامَ ثَلَاثَ عُقَدٍ يَضْرِبُ عَلَى كُلِّ عُقْدَةٍ: عَلَيْكَ لَيْلٌ طَوِيلٌ فَارْقُدْ. فَإِنِ اسْتَيْقَظَ فَذَكَرَ اللَّهَ انْحَلَّتْ عُقْدَةٌ فَإِنْ تَوَضَّأَ انْحَلَّتْ عُقْدَةٌ فَإِنْ صَلَّى انْحَلَّتْ عُقْدَةٌ فَأَصْبَحَ نَشِيطًا طيب النَّفس وَإِلَّا أصبح خَبِيث النَّفس كسلانا
From Abu Hurayrah: The Messenger of Allah ﷺ said: "Shaytan ties three knots at the back of the head of one of you when he sleeps, striking each knot [with the words]: 'You have a long night, so sleep.' If he wakes up and remembers Allah, a knot is undone; if he performs wudu, a knot is undone; and if he prays, a knot is undone, and he begins the morning energetic and in good spirits. Otherwise he begins the morning in bad spirits and lazy."