Bara bin Azib reported,

When the Messenger of Allah ﷺ wanted to sleep, he would rest his head on his right hand and say, "O Allah, protect me from Your punishment on the Day You gather Your servants."In another wording, "on the Day You resurrect Your servants."

Azami 11244

Sahih

عن البراء بن عازب قال

كان رسول الله ﷺ إذا أراد أن ينام، توسد يمينه، ويقول: اللهم قني عذابك يوم تجمع عبادك. وفي لفظ يوم تبعث عبادك

الأعظمي 11244صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Morning and evening supplications
Section
Supplications and remembrances narrated when going to sleep and when waking up
Numbering
Jami al-Kamil 11244 (2nd edition)
Azami 11244