It was narrated that ‘Abd-Allaah ibn Mas’ood (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “If a person who is afflicted by anxiety or sorrow says:
‘Allaahumma inni ‘abduka wa ibnu ‘abdika wa ibn ammatika naasiyati bi yadika maadin fiyya hukmuka ‘adlun fiyya qadaa’uka as’aluka bi kulli ismin huwa laka sammayta bihi nafsaka aw ‘allamtahu ahadan min khalqika aw anzaltahu fi kitaabika aw asta’tharta bihi fi ‘ilm il-ghaybi ‘indaka an taj’al al-Qur’aana rabee’a qalbi wa noora sadri wa jalaa’a huzni wa dhahaaba hammi
(O Allaah, I am Your slave, son of Your slave, son of Your female slave, my forelock is in Your hand, Your command over me is forever executed and Your decree over me is just. I ask You by every name belonging to You with which You have named Yourself, or, or You have taught to any of Your creation, or You have revealed in Your Book, or You have preserved in the knowledge of the Unseen with You, that You make the Qur’aan the life of my heart and the light of my breast, and a departure for my sorrow and a release for my anxiety)’,
then Allaah :swt: will take away his anxiety and sorrow, and will replace it with joy.”
It was said: “O Messenger of Allaah :swt:, should we not learn it?” He said: “Yes, whoever hears it should learn it.”
Narrated by Ahmad; classed as saheeh by Shaykh al-Albaani in al-Silsilah al-Saheehah, 199