When the Messenger of Allah (ﷺ) wanted to go to sleep, he put his right hand under his cheek and would then say:
اللَّهُمَّ قِنِي عَذَابَكَ يَوْمَ تَبْعَثُ عِبَادَكَ
Allāhumma qinī `adhābaka yawma tab`athu `ibādak
O Allah, safeguard me from Your Punishment the Day You resurrect Your slaves
(Sunan Abi Dawud 5045, Authenticated by Al Albani as Sahih)