Is it permissible to pray to die before my appointed time comes?
Question

                I pray to my Lord to take me in death before my appointed time comes, during the month of Ramadan, when I am prostrating. Is it permissible for me to pray for that or is it not permissible? May Allah reward you with good, bless you and bring forth many more like you.
Praise be to Allah.The one who prays to die before his appointed time comes is transgressing the limits in his supplication on two counts:
(Firstly) he is not believing in the implications of the verse in which Allah, may He be exalted, says (interpretation of the meaning):
“And if Allah were to impose blame on the people for their wrongdoing, He would not have left upon the earth any creature, but He defers them for a specified term. And when their term has come, they will not remain behind an hour, nor will they precede [it]”
[an-Nahl 16:61].
It was narrated from Abu Umaamah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Jibreel inspired to me that no soul will depart from this world until its time is complete and it has received its provision in full, so maintain your dignity when seeking provision, and do not let the slowness of provision prompt you to seek it by disobeying Allah, for what is with Allah cannot be attained except by obeying Him.”
Narrated by at-Tabaraani in al-Mu‘jam al-Kabeer (8/166); classed as saheeh by al-Albaani.
Everything has an appointed time and a limit with Allah, and if someone prays to die before the appointed time, that is indicative of some shortcoming in his belief in the divine will and decree, and in his understanding thereof.
(Secondly), such a supplication is contrary to the teaching of the Prophet (blessings and peace of Allah be upon him), because he forbade the Muslim to pray for his own death in many hadiths, and the scholars are unanimously agreed that all of these reports are sound.
Even though the scholars have discussed many situations in which people might wish for death, but each situation has its own ruling and in most cases people wish for death when it is not allowed. We will quote here some of the words of the scholars concerning the issue of wishing for death in various situations.
Al-Haafiz Ibn Rajab (may Allah have mercy on him) said:
Imam Ahmad narrated from Jaabir that the Prophet (blessings and peace of Allah be upon him) said: “Do not wish for death, for the horror that the dying person experiences at the moment of death is too difficult to bear. Living a long life and being guided by Allah to turn to Him and repent is a sign of being blessed.” Musnad Ahmad (426/22); classed as hasan by the commentators in the Mu’sasat ar-Risaalah edition.
Wishing for death may take place for several reasons:

Wishing for death because of some worldly calamity that has befallen one. 

It is forbidden at that time to wish for death. In as-Saheehayn, it is narrated that Anas (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said:
“No one of you should wish for death because of some harm that has befallen him. If he must wish for it, then let him say: ‘O Allah, keep me alive so long as living is good for me, and cause me to die when death is good for me.”
Narrated by al-Bukhaari (6351) and Muslim (2680).
The reason why it is disliked in this situation is that when a person wishes for death because of some harm that has befallen him, he only wishes for it so that he might have relief from the pain he is going through, and he does not know what his fate will be after death; perhaps he will find himself suffering pain greater than that which he is currently facing, and he will be like one who flees from the heat of the desert to the fire. According to the hadith, the Prophet (blessings and peace of Allah be upon him) said: “The only one who will find relief in death is the one who is forgiven.” Saheeh when all its isnaads are taken into consideration. See: as-Silsilah as-Saheehah (1710). Hence it is not appropriate for him to pray for death, unless he stipulates a condition, asking for that only if it is better for him before Allah, may He be glorified and exalted. The same applies when a person does not know what is better for him, such as wealth or poverty, and so on. Similarly, it is prescribed for him to seek Allah’s guidance (istikhaarah) with regard to what he wants to do and does not know whether it is good for him or not. Rather he should ask Allah in definitive and certain terms for that which he knows is completely good for him, such as forgiveness, mercy, pardon, well-being, piety, guidance and so on.

Wishing for death for fear of being tempted and drifting away from religious commitment. 

It is permissible in this case; some of the Sahaabah and leading scholars of Islam wished for death and prayed for it for fear of being tempted and drifting away from religious commitment. In the hadith it says: “If You decree that some people will drift away from religious commitment, then take me to You when I am still adhering to Your religion and have not drifted away.”

Wishing for death in circumstances where there is the opportunity for martyrdom, so as to make the most of this opportunity. 

In that case it is also permitted, and there are many well-known instances of the Sahaabah asking for martyrdom and seeking it when engaging in battle. Similarly, Mu‘aadh prayed that he and his household would be stricken by the plague when it occurred in Syria.

Wishing for death when one is confident of one’s deeds, by way of longing to meet Allah, may He be glorified and exalted. 

This is also permissible, and many of the early generations (salaf) did that. Abu’d-Dardaa’ said: I welcome death, for I long to meet my Lord. Abu ‘Anbasah al-Khawlaani said: For those who came before you, meeting Allah was sweeter than nectar. One of them said: I have longed to meet You for a very long time, so hasten my coming to You. The fact that this is permissible is indicated by the verses in which Allah, may He be glorified and exalted, says (interpretation of the meaning):
“Say, [O Muhammad], If the home of the Hereafter with Allah is for you alone and not the [other] people, then wish for death, if you should be truthful”
[al-Baqarah 2:94]
“Say, O you who are Jews, if you claim that you are allies of Allah , excluding the [other] people, then wish for death, if you should be truthful”
[al-Jumu‘ah 62:6].
This indicates that the close friends of Allah do not hate death; rather they wish for it. Then Allah tells us that “they will not wish for it, ever, because of what their hands have put forth.” [al-Jumu‘ah 62:7]. This indicates that those who commit sin hate death, because they fear facing the consequences of their sin. As one of the salaf said: No one hates death except a doubter. According to the hadith of ‘Ammaar ibn Yaasir, the Prophet (blessings and peace of Allah be upon him) said: “I ask You for the pleasure of gazing upon Your Countenance and longing to meet You without the reason being some painful calamity or the fear of losing my religious commitment and being misguided.” Longing to meet Allah, may He be exalted, can only be through loving death, and that (loving death) does not usually happen except in the case of a painful calamity in this world, or for fear of losing one’s religious commitment and being misguided. But if it is not for these two reasons, then it may be out of pure longing to meet Allah, may He be glorified and exalted, and this is what is asked for in this hadith. Therefore the one who is obedient to Allah feels a sense of comfort with his Lord, so he loves to meet Allah and Allah loves to meet him. The one who is disobedient to Allah feels a sense of alienation between himself and his Lord, and the reason for that is sin; therefore he hates to meet his Lord, even though it is inevitable. Dhu’n-Noon said: Every obedient person is comforted and every disobedient person feels alienated.
Abu Bakr as-Siddeeq said to ‘Umar (may Allah be pleased with them both) in his last instructions to him at the time of death: If you heed my advice, nothing that is absent will be dearer to you than death, which is inevitable, and if you ignore my advice, then nothing will be more hateful to you than death, although you can never escape it. Abu Haazim said: Give up every deed because of which you fear death, then it will not matter when you die.

Wishing for death in situations other than those mentioned above. 

The scholars differed as to whether that is disliked or recommended. Some of the early generations granted concessions allowing that, whereas others regarded it as disliked.
The reason for the prohibition on wishing for death mentioned in the hadith of Jaabir was explained as being composed of two reasons:
The first reason is that the horror that the dying person experiences at the moment of death is too difficult. That horror that the dying person experiences at the moment of death is terror the like of which he has never experienced in this life, namely seeing the angels, seeing his deeds both good and bad, and the tidings that he may be given at that moment of paradise or hell. In addition to that, there is the hardship, agony and distress of death. Al-Hasan said: If the son of Adam knew that in death he would find comfort and joy, he would still dread facing death, because he knows of its agony, pain and horror. So how about if he dies not knowing what there may be for him after death of eternal bliss or eternal punishment? It is as if the one who wishes for death is seeking to hasten the pain and suffering that will befall him, when we have been commanded to ask for well-being.
Ibn ‘Umar heard a man wishing for death, and said: Do not wish for death, for you will surely die; rather ask Allah for well-being.
Ibraaheem ibn Adham said: Death has a cup and no one can bear it except one who fears Allah and is obedient to Him, and expecting it. Even ‘Umar said at the time of death: If I possessed all that exists on earth, I would offer it as a ransom to be spared the terror of the moment of death.
The second reason is the fact that the long life of the believer can only be good for him. A long life in which Allah gives a person the opportunity to turn to Him and repent from previous sins, and to strive to do righteous deeds, is a sign of being blessed. If a person longs for death, then he is longing for his righteous deeds to come to an end, and that is not appropriate.
There are many hadiths that speak of this matter, all of which indicate that it is forbidden to wish for death in all circumstances, and that a long life is better for the believer, for it will allow him to increase his good deeds.
End quote from Lataa’if al-Ma‘aarif (295-305). See also: Sharh Hadith ‘Ammaar ibn Yaasir by al-Haafiz Ibn Rajab al-Hanbali (may Allah have mercy on him).
This topic has been discussed previously in question no. 46592.
And Allah knows best.