It is narrated from Sayyiduna Jabir (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "When any man or woman sleeps, three knots are tied at the back of his head. If he remembers Allah upon waking, one knot is untied; if he gets up and performs ablution, the second knot is untied; and if he stands up and prays, the third knot is also untied."
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 14387