At-Tirmidhi narrated in his Sunan that Khalid once complained to the Prophet (peace be upon him) that he does not sleep well at night. The Prophet (peace be upon him) said: "When you go to bed say, 'O Allah! The Lord of the seven heavens and what is under them, the Lord of the earths and what they carry, and the Lord of the devils and whoever they misguide! Be my supporter against the evil of all Your creation, preventing any of them to cause me any harm or injustice. Mighty indeed are those whom You support, honorable indeed is Your praise, and there is no deity worthy of worship except You.'"
Also, At-Tirmidhi narrated that the Messenger of Allah (peace be upon him) used to teach his companions these words when they face any fear, "I seek refuge with Allah's perfect Words from His anger and torment, and from the evil of His slaves and the whisperings of the devils. I seek refuge with You, my Lord from their precense.'"
Taken From: Healing With The Medicine Of The Prophet (peace be upon him), By Imam Ibn Qayyim Al-Jauziyah