The Prophet (peace and blessings of Allaah be upon him) said: “The best of people is the one who lives long and does good.” Narrated by Ahmad and al-Tirmidhi, 110; classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
And he (peace and blessings of Allaah be upon him) said: “Glad tidings to the one who lives long and does good.” Narrated by al-Tabaraani and Abu Na’eem, classed as saheeh by al-Albaani in Saheeh al-Jaami’, 3928.
Ahmad (8195) narrated that Abu Hurayrah (may Allaah be pleased with him) said: Two men became Muslim with the Prophet (peace and blessings of Allaah be upon him). One of them was martyred, and the other remained for another year. Talhah ibn ‘Ubayd-Allaah said: I was shown Paradise (in a dream), and in it I saw that the one who was delayed was admitted before the martyr. I was surprised by that, so the next morning I told the Messenger of Allaah (peace and blessings of Allaah be upon him) about that. The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Did he not fast Ramadaan after he was gone, and pray six thousand rak’ahs, or such and such a number of rak'ahs, the prayers of one year?” Classed as saheeh by al-Albaani in al-Silsilah al-Saheehah, 2591. al-‘Ajlooni said in Kashf al-Khafa’: its isnaad is hasan.
A man said: “O Messenger of Allaah, which of the people is best?” He said: “The one who lives long and does good.” He said: “Which of the people is worst?” He said: “The one who lives long and does evil.” Narrated by Ahmad and al-Tirmidhi, 2330; classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
Al-Teebi (may Allaah have mercy on him) said: Time is like the capital of a businessman, and it should be invested in such a way as to make a profit. The greater the capital, the greater the profit. Whoever benefits from his life by doing good deeds will succeed and prosper, but whoever wastes his capital and does not prosper will evidently lose out. End quote.
Hence it was said to one of the salaf: Death is a good thing.
He said: O son of my brother, do not do that, for an hour of life in which you ask Allaah for forgiveness is better for you than an eternity of death.
It was said to an old man among them: Would you not like to die? He said: No, for youth and its evil have gone, and old age and its goodness have come. When I get up, I say Bismillaah (in the name of Allaah), and when I sit I say Al-hamdu Lillaah (praise be to Allaah), and I would like this to continue.
Many of the salaf would weep when they were dying, in sorrow for the cessation of their righteous deeds.
Hence the Prophet (peace and blessings of Allaah be upon him) forbade wishing for death, because it deprives the believer of the goodness of obedience and the joy of worship, and of the opportunity to repent and make up for what one has missed.
It was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “No one of you should wish for death or pray for it before it comes, for when one of you dies, his good deeds come to an end and for the believer a long life will not increase him in anything but good.” Narrated by Muslim, 2682
So he mentioned the prohibition of wishing for death alongside the prohibition on praying for one's own death.
A version narrated by al-Bukhaari says: “No one of you should wish for death. Either he is a doer of good and will do more, or he is a doer of evil but perhaps he may stop.”
Al-Nawawi said: This hadeeth clearly indicates that it is makrooh to wish for death because of some harm that has befallen one, such as loss or distress caused by an enemy, or other such hardships of this world. But if a person fears harm or fitnah with regard to his religious commitment, it is not makrooh to wish for death, according to this hadeeth, and several of the salaf did that.
There is another reason why wishing for death is not allowed:
The throes of death are very hard, and the terror of seeing one's end draw nigh is immense. Man is faced with nothing else like it. Moreover, no one knows what awaits him after death. We ask Allaah to keep us safe and sound. Wishing for death is seeking something which is unknown. Perhaps if he wishes for death because of some hardship that he has fallen into, he may end up like one who jumps out of the frying pan and into the fire, and after death he may find himself in an even worse situation. In that case, wishing for death is akin to seeking to hasten calamity before it happens. No wise man should do that, as the Prophet (peace and blessings of Allaah be upon him) said: “Do not wish to meet the enemy, and ask Allaah to keep you safe and sound.” (Agreed upon). A hadeeth to this effect has been narrated, but it is da’eef (weak).
It was narrated that Jaabir ibn ‘Abd-Allaah (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Do not wish for death, for the terror that follows death is immense. It is a sign of blessing to live long and be guided by Allaah to repent.” Narrated by Ahmad; classed as da’eef by al-Albaani in Silsilat al-Ahaadeeth al-Da’eefah, 885.