Sahih Muslim , Hadith 2714

Abu Huraira reported Allah's Messenger as say- ing: When any one of you goes to bed, he should take hold of the hem of his lower garment and then should clean (his bed) with the help of that and then should recite the name of Allah for he himself does tiot know what he left behind him on his bed, and when he intends to lie on bed, he should lie on his right side and utter these words:" Hallowed be Allah, my Lord. It is with Thine (grace) that I place my side (upon the bed) and it is with Thee that I take it up (after sleep), and in case Thou withholdst my being (if thou causest me to die), then grant pardon to my being, and if Thou keepst (this process of breathing on), then protect it with that with which Thou protected Thine pious servants."

وَحَدَّثَنَا إِسْحَاقُ بْنُ مُوسَى الأَنْصَارِيُّ، حَدَّثَنَا أَنَسُ بْنُ عِيَاضٍ، حَدَّثَنَا عُبَيْدُ اللَّهِ، حَدَّثَنِي سَعِيدُ بْنُ أَبِي سَعِيدٍ الْمَقْبُرِيُّ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ إِذَا أَوَى أَحَدُكُمْ إِلَى فِرَاشِهِ فَلْيَأْخُذْ دَاخِلَةَ إِزَارِهِ فَلْيَنْفُضْ بِهَا فِرَاشَهُ وَلْيُسَمِّ اللَّهَ فَإِنَّهُ لاَ يَعْلَمُ مَا خَلَفَهُ بَعْدَهُ عَلَى فِرَاشِهِ فَإِذَا أَرَادَ أَنْ يَضْطَجِعَ فَلْيَضْطَجِعْ عَلَى شِقِّهِ الأَيْمَنِ وَلْيَقُلْ سُبْحَانَكَ اللَّهُمَّ رَبِّي بِكَ وَضَعْتُ جَنْبِي وَبِكَ أَرْفَعُهُ إِنْ أَمْسَكْتَ نَفْسِي فَاغْفِرْ لَهَا وَإِنْ أَرْسَلْتَهَا فَاحْفَظْهَا بِمَا تَحْفَظُ بِهِ عِبَادَكَ الصَّالِحِينَ ‏" ‏ ‏.‏

sunnah.com

This hadith has been narrated on the authority of Ubaidullah b. Umar with the same chain of transmitters and he said: Then utter:" My Lord. with Thine name I place my side and if Thou keepest me alive have mercy upon myself"

وَحَدَّثَنَا أَبُو كُرَيْبٍ، حَدَّثَنَا عَبْدَةُ، عَنْ عُبَيْدِ اللَّهِ بْنِ عُمَرَ، بِهَذَا الإِسْنَادِ وَقَالَ ‏ "‏ ثُمَّ لْيَقُلْ بِاسْمِكَ رَبِّي وَضَعْتُ جَنْبِي فَإِنْ أَحْيَيْتَ نَفْسِي فَارْحَمْهَا ‏" ‏ ‏.‏

sunnah.com