Mishkat al-Masabih
Hudhaifa said that when the Prophet (ﷺ) wanted to go to sleep he placed his hand under his head and said, "O God, guard me from thy punishment on the day when Thou gatherest Thy servants," or "raisest up Thy servants." Tirmidhi transmitted it, and Ahmad gave al-Bara’ as his authority.
وَعَنْ حُذَيْفَةَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ كَانَ إِذَا أَرَادَ أَنْ يَنَامَ وَضَعَ يَدَهُ تَحْتَ رَأْسِهِ ثُمَّ قَالَ: «اللَّهُمَّ قِنِي عَذَابَكَ يَوْمَ تَجْمَعُ عِبَادَكَ أَوْ تَبْعَثُ عِبَادَكَ» . رَوَاهُ التِّرْمِذِيّ وَرَوَاهُ أَحْمد عَن الْبَراء
Reference