The Prophet ﷺ used to say when he retired to his bed, "Allah, Lord of the seven heavens, Lord of the earth, Lord of everything, Splitter of the grain and the date stone, Revealer of the Torah, the Gospel, and the Quran, I seek refuge in You from the evil of every creature whose forelock You hold. You are the First, so there is nothing before You. You are the Last, so there is nothing after You. You are the Manifest, so there is nothing above You. You are the Hidden, so there is nothing beyond You. Settle my debt for me and free me from poverty."
حدثنا عفان حدثنا وهيب حدثنا سهيل عن أبيه
عن النبي ﷺ أنه كان يقول إذا أوى إلى فراشه اللهم رب السموات السبع ورب الأرض ورب كل شيء فالق الحب والنوى منزل التوراة والإنجيل والقرآن أعوذ بك من شر كل ذي شر أنت آخذ بناصيته أنت الأول فليس قبلك شيء وأنت الآخر فليس بعدك شيء وأنت الظاهر فليس فوقك شيء وأنت الباطن فليس دونك شيء اقض عني الدين وأغنني من الفقر
Its isnad is sahih. Muslim reported it in the Book of Remembrance and Supplication, What to Say Upon Sleeping, number 61-62-63, Abu Dawud in the Book of Manners, chapter 106, What to Say Upon Sleeping, Tirmidhi in the Book of Supplications, 518/5, chapter 68, number 3481, where he said, hasan gharib, and Ibn Majah, 3831.