Abdullah bin Amr bin As reported,

The Messenger of Allah ﷺ said, "When one of you is frightened during sleep, let him say, 'I seek refuge in the perfect words of Allah from His anger, His punishment, the evil of His servants, the whisperings of the devils, and lest they come near me.' Then it will not harm him."Abdullah bin Umar used to teach these words to those of his children who had reached the age of understanding, and for those who had not yet reached it, he would write the words on a piece of parchment and hang it around the child's neck.

Tirmidhi 3528

Daif

حدثنا علي بن حجر حدثنا إسمعيل بن عياش عن محمد بن إسحق

عن عمرو بن شعيب عن أبيه عن جده

أن رسول الله ﷺ قال إذا فزع أحدكم في النوم فليقل أعوذ بكلمات الله التامات من غضبه وعقابه وشر عباده ومن همزات الشياطين وأن يحضرون فإنها لن تضره وكان عبد الله بن عمر يلقنها من بلغ من ولده ومن لم يبلغ منهم كتبها في صك ثم علقها في عنقه

الترمذي 3528ضعيف
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Supplications
Chapter
Unnamed
Numbering
Darussalam 3528
Tirmidhi 3528