The Messenger of Allah ﷺ said, "When one of you goes to his bed, let him dust off his bedding with the inner edge of his lower garment, then lie down on his right side and say, 'In Your name, my Lord, I lay down my side, and by You I raise it. O Allah, if You take my soul, have mercy on it, and if You release it, protect it with that by which You protect Your righteous servants.'"
حدثنا يحيى عن عبد الله قال حدثني سعيد
قال رسول الله ﷺ إذا أوى أحدكم إلى فراشه فلينفض فراشه بداخلة إزاره وليتوسد يمينه ثم ليقل باسمك رب وضعت جنبي وبك أرفعه اللهم إن أمسكتها فارحمها وإن أرسلتها فاحفظها بما حفظت به عبادك الصالحين
Its isnad is sahih, it occurred previously in 2/295, and it was also related by Abu Dawud, 4/311, no. 5050, in the Book of Manners, chapter on what is said at bedtime, and by Ibn Sunni in Amal al-Yawm, 226, no. 704.