Abdullah ibn Mas’ud reported: The Messenger of Allah, peace and blessings be upon him, said:

مَا مِنْكُمْ مِنْ أَحَدٍ إِلَّا وَقَدْ وُكِّلَ بِهِ قَرِينُهُ مِنْ الْجِنِّ

Each one of you has a devil-companion from the jinn over him.

They said, “Even you, O Messenger of Allah?” The Prophet صلى الله عليه وسلم said:

وَإِيَّايَ إِلَّا أَنَّ اللَّهَ أَعَانَنِي عَلَيْهِ فَأَسْلَمَ فَلَا يَأْمُرُنِي إِلَّا بِخَيْرٍ

Even me, yet Allah helped me against him until he embraced Islam. He does not order me to do anything but good.

Ṣaḥīḥ Muslim 2814