The author – may Allah shower blessings on him – said in his Book, Riyaadus Saaliheen: 'Chapter on supplication when one is disappointed about his life.'
Total despair about life cannot be known except at the throes of death, but before then, a person should never lose hope. There are several people whose illness have deteriorated badly such that their families had prepared the water for their funeral bath, shrouds and other relevant materials, then Allah heals them. There are several people who came close to death, being stranded in the desert without water or food, and then Allah, Honored and Glorious is He, rescued them from it.
One of such instance is that which the Prophet ﷺ said: 'Allah is more pleased with the repentance of his servant than one of you is pleased about his ride when he looses it,' in another text: 'upon it (the ride) is his food and drink. He searches for it but finds it not, so he goes to sleep under a tree awaiting death.'(1) He had lost hope of finding it and was expecting nothing but death.
While he was in that situation, suddenly he found the bridle of his ride fastened to the tree. Allah returned his missing beast to him; it came to the tree and its bridle got entangled. The man seized it and
said: 'O Allah, You are my servant and I am Your Lord.' He intended to say: 'You are my Lord and I am Your servant,' but erred due to extreme joy. This man gave up all hope of life due to his estimation of his predicament; he had lost his food and drink. However, true despair is when one is in the pangs of death, that is, when life is no longer possible. Allah - the most High - said:
"Then why do you not ((intervene) when (the soul of a dying person) reaches the throat? And you at the moment are looking on." (Al-Waqiah: 83, 84)
That is, when the soul (in a bid to leave the body) reaches the throat.
"But We are nearer to him than you, but you see not." (Al-Waqiah: 85)
That is, our angels are closer to a person than his throats at the point of death.
"Then why do you not, if you are exempt from the reckoning and recompense (punishment, and so on). Bring back the soul (to its body), if you are truthful? (Al-Waqiah: 86, 87)
Who is capable (of this)? Is there anyone who can return the soul whence it has reached the throat?! Impossible! So, a man despairs of his life only when death becomes obvious. At this moment, what should he say? A'ishah said: 'The Prophet ﷺ used to say: 'Allahumma ighfir-li, wa rhamni, wa alhiqni bir Rafiqil-A'la (O Allah forgive me, bestow mercy on me, and let me join the exalted companions). This is the Messenger ﷺ on the throes of death, though Allah had forgiven him for his past and future.
Who are the exalted companions? These are the prophets, the truthful ones, the martyrs and the righteous; what an excellent
companionship they are!
This was the statement of the Messenger of Allah ﷺ during his last moment and he had a bowl of water with him. He suffered severe hardship and agony of death that no other has experienced because his illness was that of two men. Why was his sickness and agony this severe? The reason was for him to attain the peak of perseverance, because patience requires something upon which to be exemplified. It is as though Allah chose for His Prophet ﷺ that his illness and agony be severe, so that he ﷺ may attain the peak among those who show perseverance.
He would dip his hand into the bowl of water and wipe his face saying: 'O Allah, help me over the pangs and agony of death,' that is, help me to withstand it, being patient and retaining consciousness, not loosing my senses, and such that I am able to pronounce the testimony 'La ilaha illa Allah wa anna Muhammadan Rasulul-lahi' (There is no god worthy of worship except Allah and Muhammad is the Messenger of Allah). This is because that moment is grave, terrifying and difficult. If Allah, Honored and Glorious is He - does not assist you to be patient, then your condition is perilous. Hence, he ﷺ would say: 'O Allah, help me over the hardship of death,' and in another narration, he said: 'There is no god worthy of worship except Allah. Truly, there is agony in death.'(1) The Prophet ﷺ was truthful:
"And the stupor of death will come in truth: this is what you have been avoiding." (Qaf: 19)
We beseech Allah to help you and us over the hardships of death, grant us good end, take our souls upon firm faith, pure Islamic monotheism and when He is pleased with us.
He is capability over all things.