Sunan Ibn Majah 3874
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)."
حَدَّثَنَا أَبُو بَكْرٍ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ نُمَيْرٍ، عَنْ عُبَيْدِ اللَّهِ، عَنْ سَعِيدِ بْنِ أَبِي سَعِيدٍ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ ـ صلى الله عليه وسلم ـ قَالَ ‏
"‏ إِذَا أَرَادَ أَحَدُكُمْ أَنْ يَضْطَجِعَ عَلَى فِرَاشِهِ فَلْيَنْزِعْ دَاخِلَةَ إِزَارِهِ ثُمَّ لْيَنْفُضْ بِهَا فِرَاشَهُ فَإِنَّهُ لاَ يَدْرِي مَا خَلَفَهُ عَلَيْهِ ثُمَّ لْيَضْطَجِعْ عَلَى شِقِّهِ الأَيْمَنِ ثُمَّ لْيَقُلْ رَبِّ بِكَ وَضَعْتُ جَنْبِي وَبِكَ أَرْفَعُهُ فَإِنْ أَمْسَكْتَ نَفْسِي فَارْحَمْهَا وَإِنْ أَرْسَلْتَهَا فَاحْفَظْهَا بِمَا حَفِظْتَ بِهِ عِبَادَكَ الصَّالِحِينَ ‏"‏ ‏.‏