It was narrated from Abu Hurairah that:the Messenger of Allah (saas) said: "When anyone of you wants to go to bed, let him undo the edge of his Izar (waist wrap) and dust of his bed with it, for he does not know what came to it after him. Then let him lie down on his right side and say: 'Rabbi bika wada'tu janbi wa bika arfa'uhu, fa in amsakta nafsi farhamha, wa in arsaltaha fahfazha bima hafizta bihi 'ibadikaas-salihin (O Lord, by Your leave I lie down and by Your leave I rise, so if You should take my soul then have mercy on it, and if You should return my soul then protect it as You protect Your righteous slaves)
Hadith No. 3874
Sunan Ibn Majah
Gradings:
Al-Albani:
Sahih
Muhammad Fouad Abd al-Baqi:
Sahih
Shuaib Al Arnaut:
Sahih
Zubair Ali Zai:
Sahih Bukhari