It is narrated from Hazrat Bara’ bin ‘Azib (may Allah be pleased with him), he says that the Noble Messenger (peace and blessings be upon him) said: When you go to your bed, perform ablution as you do for prayer. Then lie down on your right side and say: “O Allah! I have turned my face towards You. I have entrusted my affairs to You. I have relied upon You in hope of Your reward and in fear of Your punishment. There is no refuge and no escape except with You. O Allah! I believe in the Book which You have revealed, and in the Prophet whom You have sent.” If you die that night in this state, you will die upon the natural faith (fitrah). And recite this supplication at the end of all your words. Hazrat Bara’ says: I repeated this supplication before the Messenger of Allah (peace and blessings be upon him). When I reached [“I believe in Your Book which You have revealed”], I said “and Your Messenger.” He (peace and blessings be upon him) said: No, (rather say) “and Your Prophet whom You have sent.”
Hazrat Abu Huraira (may Allah be pleased with him) narrated that the Noble Prophet (peace and blessings of Allah be upon him) said: When any one of you lies down on his bed, he should first dust his bed with the edge of his lower garment, because he does not know what may have come onto it in his absence. Then he should recite this supplication: "O my Sustainer! In Your name I have laid down my side and in Your name I will raise it. If You take my soul, then have mercy on it, and if You let it go (keep me alive), then protect it as You protect Your righteous servants."