The Messenger of Allah ﷺ said, "There is no male or female except that upon his head, when he goes to sleep, Jareer ties three knots. If he wakes and remembers Allah, one knot is loosened. If he rises and performs ablution, another knot is loosened. And if he stands to pray, all his knots are loosened."
قال رسول الله ﷺ: ما من ذكر ولا أنثى إلا وعلى رأسه جرير معقود ثلاث عقد حين يرقد، فإن استيقظ فذكر الله انحلت عقدة، فإذا قام فتوضا انحلت عقدة، فإذا قام إلى الصلاة انحلة عقده كلها.
Imam Ahmad narrated it (14387) from Abu Muawiya, who said, Amash narrated to us, from Abu Sufyan, from Jabir, and he mentioned it. Its isnad is sahih.Ibn Khuzayma narrated it (1133), and from him Ibn Hibban (2554), via Hafs bin Ghiyath, from Amash, and in it, "On his head is a rope tied while he sleeps. If he wakes and remembers Allah, a knot is undone. Then if he gets up, performs wudu, and prays, the knots are undone."Ibn Khuzayma also narrated it via Shayban, from Amash, adding, "and he wakes up light."Abu Yaala narrated it (2298) via Abdullah bin Numayr, from Amash, adding, "and he wakes up energetic, having attained good. But if he sleeps without remembering Allah, he wakes up with his knots heavy upon him."Ibn Hibban narrated it (2556) via Isa bin Yunus, from Amash, adding, "and if he wakes up without having remembered Allah, he wakes up with his knots still on him, and he wakes up heavy, lazy, having attained no good."The hadith has other routes of transmission from Amash, and the ones I have mentioned are the most sahih of them.Ibn Khuzayma said, "Jarir means rope."