TIRMIDHI 3528:
from ʿAmr b. Shuʿayb from his father from his grandfather —
“When one of you becomes frightened during sleep, then let him say: ‘I seek refuge in Allah’s Perfect Words from His anger, His punishment, and the evil of His creatures, from the whisperings of the Shayatin, and that they should come (Aʿūdhu bikalimātillāhit-tāmmati min ghaḍabihī wa ʿiqābihī wa sharri ʿibādih, wa min hamazātish-shayāṭīni wa an yaḥḍurūn).’ For verily, they shall not harm him.” He said: “So ʿAbdullah bin ʿAmr used to teach it to those of his children who attained maturity, and those of them who did not, he would write it on a sheet and then hang it around his neck.”
الترمذي ٣٥٢٨:
عن عمرو بن شعيب عن أبيه عن جده —
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ إِذَا فَزِعَ أَحَدُكُمْ فِي النَّوْمِ فَلْيَقُلْ أَعُوذُ بِكَلِمَاتِ اللَّهِ التَّامَّةِ مِنْ غَضَبِهِ وَعِقَابِهِ وَشَرِّ عِبَادِهِ وَمِنْ هَمَزَاتِ الشَّيَاطِينِ وَأَنْ يَحْضُرُونِ فَإِنَّهَا لَنْ تَضُرَّهُ قَالَ وَكَانَ عَبْدُ اللَّهِ بْنُ عَمْرٍو يُلَقِّنُهَا مَنْ بَلَغَ مِنْ وَلَدِهِ وَمَنْ لَمْ يَبْلُغْ مِنْهُمْ كَتَبَهَا فِي صَكٍّ ثُمَّ عَلَّقَهَا فِي عُنُقِهِ
hadithunlocked.com