`Amr bin Shu`aib narrated from his father, from his grandfather, that the Messenger of Allah (ﷺ) said:
“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.”