Sayyiduna Abdullah bin Amr (may Allah be pleased with him) narrates: When the Prophet (peace and blessings be upon him) was about to sleep, he (peace and blessings be upon him) used to recite:
'Allahumma fatiras-samawati wal-ard, 'alimal-ghaybi wash-shahadah, rabba kulli shay'in wa ilaha kulli shay', ashhadu an la ilaha illa anta wahdaka la sharika lak, wa anna Muhammadan 'abduka wa rasuluka wal-mala'ikatu yashhadun, Allahumma inni a'udhu bika minash-shaytani wa shirkihi wa an aqtarifa 'ala nafsi ithman aw aruddahu ila muslim' (O Allah, Originator of the heavens and the earth, Knower of the unseen and the seen, Lord of everything, God of everything! I bear witness that there is no god other than You; You alone are God, You have no partner, and indeed Sayyiduna Muhammad (peace and blessings be upon him) is Your servant and Your Messenger, and the angels also bear witness to this. O Allah, I seek refuge in You from Satan and his shirk, and also from committing any sin or passing it on to a Muslim).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الأذكار / 17041