Praise be to Allah.
Imaam Ahmad reported from ‘Abdullah ibn Mas‘ood, may Allaah be pleased with him: "The Messenger of Allaah (Peace & Blessings of Allaah be upon Him) said: "There is no slave who, when he is stricken by anxiety and sorrow, says ‘O Allaah, I am Your slave and the son of Your male slave and female slave. My forelock is in Your hand (i.e., You have complete mastery over me), Your command over me is forever executed, and Your decree over me is just. I ask You by every name belonging to You which You named Yourself with, or revealed in Your Book, or You taught to any of Your creation, 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’ - but Allaah will remove his sorrow and replace his grief with joy." The people said: "O Messenger of Allaah, we should learn these words." He said: "The one hears them should learn them."
Ibn ‘Abbaas reported that at times of distress, the Messenger of Allaah (Peace & Blessings of Allaah be upon Him) used to say: "There is no god but Allaah, the All-Great, the Patient; there is no god but Allaah, Lord of the Mighty Throne; there is no god but Allaah, the Lord of heaven, the Lord of earth, and the Lord of the Noble Throne." (reported by al-Bukhaari, may Allaah have mercy on him, no. 5870).
The Prophet (Peace & Blessings of Allaah be upon Him) said: "The prayer for one stricken by distress is: "O Allaah, it is Your mercy that I hope for, so do not leave me in charge of my affairs even for a blink of an eye, and rectify for me all of my affairs. None has the right to be worshipped except You." (Reported by Imaam Ahmad in al-Musnad, Abu Dawud in al-Sunan, Kitaab al-Adab, Baab maa yaqool idhaa asbaha; see also Saheeh al-Jaami‘, 3388).
Asmaa’ bint ‘Umays said: "The Messenger of Allaah (Peace & Blessings of Allaah be upon Him) said to me: ‘Shall I not teach you some words to say at times of distress? "O Allaah, You are my Lord and I do not associate anything with You."’" (Reported by Abu Dawud in al-Sunan, Kitaab al-salaat, Baab fi’l-istighfaar; see also Saheeh al-Jaami‘, no. 2623).
The Prophet (Peace & Blessings of Allaah be upon Him) said to his companions: "Shall I not tell you some words which, if distress or grief befalls any of you and he offers this prayer (supplication), it will bring him joy? It is the du‘aa’ of Dhoo’l-Noon (i.e. Yunus or Jonah): ‘There is no god but You, Glory to You; verily I was one of the wrongdoers.’" (Saheeh al-Jaami‘, no. 2605).
Anas ibn Maalik said: "Whenever something distressed him, the Prophet (Peace & Blessings of Allaah be upon Him) used to say: ‘O Ever-Living, O Self-Sustaining, by Your mercy I seek Your help." (Reported by al-Tirmidhi, no. 3446).
You must recite these du‘aa’s, may Allaah benefit you thereby and replace your sorrow with joy. May Allaah bless our Prophet Muhammad.