Regarding His Guidance in the Treatment of Fear and Sleeplessness
Excerpt from the Book: Provisions for the Hereafter
by Ibn Qayyim
At-Tirmidhi narrated on the authority of Buraidah
that he said: "Khalid complained to the Messenger of Allah
saying: "Oh, Messenger of Allah! I cannot sleep at night, due to insomnia." He
"When you repair to your bed, say:
"Allahumma, Rabbas-Samawatis-Sab'i Wa Ma Azallat Wa Rabbal-Ardeena-Sab'i Wa Ma Aqallat Wa Rabbash-Shayateeni Wa Ma Adallat, Kun Lee Jaran Min Sharri Khalqika Kullihim Jamee'an An Yafruta 'Alayya Ahadun Minhum Aw Yabghiya 'Alayya 'Azza Jaruka Wa Jalla Thana'uka Wa La Ilaha Ghairuka."
"0, Allah! Lord of the seven heavens and all that they contain, Lord of the earths and all that they carry, Lord of the devils and all those whom they send astray, be a Protector for me against the evil of all of Your created beings, that they may not transgress against me and that they may not commit injustice against me. Mighty is Your Protection and Exalted is Your Praise and there is no ilah besides You." 
Also in At-Tirmidhi's'Sunan' is the Hadeeth of Amr Ibn Shu'aib, in which it is stated that the Messenger of Allah
used to teach them the following supplication as a protection against fear:
"A'udhu Bikalimatillahit-Tammati Min Ghadabihi Wa Sharri 'Ibadihi Wa Min Hamazatish-Shayateeni Wa A 'udhu Bika Rabbi An Yahdurun'' 
And 'Abdullah Ibn 'Umar
used to teach it to those of his children who were of sufficient age to memorize it and he used to write it and hang it around the necks of those who were not. 
And it is mentioned in the Hadeeth of' Amr Ibn Shu' aib in a Marfu' form:
"If you see burning, say: "Allahu Akbar", because Takbeer extinguishes it." 
Burning is caused by fire, from which Satan was created and in it there is destruction which is beloved by Satan; and fire naturally seeks to rise high and to destroy and these two attributes are the guidance of Satan, to which he calls and by which he destroys mankind, while remembrance of the Lord, the Almighty, the All Powerful restrains Satan. So when the Muslims extols his Lord by saying: "Allahu Akbar'', it extinguishes the burning and we and others have tried this and have found that it is so.
 Narrated by At-Tirmidhi, on the authority of Buraidah Ibn Al-Haseeb
it contains in its chain of narrators Al-Hakam Ibn Zuhair, of whom Yahya Ibn Ma'een said: "He is a liar," while Al-Bukhari said: "His Ahadeeth are abandoned."
 Narrated'by Abu Dawud, At-Tirmidhi and Ahmad, Shaikh Nasir Ad-Deen Al-Albani declared it to be "Hasan Lighairihi" (i.e. it is raised to the level of Hasan by another supporting narration).
 According to Shaikh Nasir Ad-Deen Al-Albani, this addition is Munkar, since it is prohibited in Islam to wear amulets, whether they be Qur' anic Verses or supplications.
 Narrated by Ibn As-Sunni in "Amal Al-Yawmi Wal-Lailah', it contains in its Sanad Al-Qasim Ibn 'Abdillah, who was described as a liar by Imam Ahmad. Shaikh Al-Albani says that a number of its narrators are weak. Pages 467-469