Bismillāh.
أَنتَ وَلِيِّي فِي الدُّنْيَا وَالْآخِرَةِ ۖ تَوَفَّنِي مُسْلِمًا وَأَلْحِقْنِي بِالصَّالِحِينَ
You are my guardian in this world and the Hereafter! Let my death be in submission [to You] and unite me with the Righteous.
(Sūrat Yūsuf, No.12, Āyat 101)
When Prophet Yūsuf ‘alayhis-salām reunites with his family he concludes his conversation with them by turning to Allah, subhānahu wata‘ālā. He expresses his gratitude to Him and acknowledges that Allah (swt) alone is his guardian and protects him from all things. He then conveys his wishes for what is important to him.
The two things he requests from Allah ‘azza wajall in the above verse are to die as a Muslim – one who has submitted to God – and to be raised with the virtuous people. He does not ask for an increase in his kingdom or any worldly benefit. What he is more concerned about is how he will leave this world and return to God. It shows the understanding of a believer who knows that whatever the world has to offer, however good or bad, will eventually pass.
To stay firm on faith till the end of life is a very important achievement. It is possible for a human being to change in faith during his lifetime. The nafs, the Shaytān, life circumstances, etc. can weaken the faith of a person and so a constant prayer of the believer is to die with faith. The hope is to have a faithful and good ending to life in this world. All prophets advised their families to die as Muslims, ensuring to preserve their faith till the end of their lives. The Quran talks about these Prophets:
وَوَصَّىٰ بِهَا إِبْرَاهِيمُ بَنِيهِ وَيَعْقُوبُ يَا بَنِيَّ إِنَّ اللَّهَ اصْطَفَىٰ لَكُمُ الدِّينَ فَلَا تَمُوتُنَّ إِلَّا وَأَنتُم مُّسْلِمُونَ
And Ibrāhīm instructed his sons and [so did] Ya‘qūb: O my sons, indeed Allah has chosen for you this religion, so do not die except while you are Muslims. (Q 2:133)
The believer also desires to be among the righteous people in the Hereafter. These are the people with a high status in the eyes of Allah (swt) and to be with them is an honor. It is a sign that God is pleased with you. Good company is important, both in this world and in the Hereafter. Believers in the Hereafter will enjoy the pleasure of each other’s company. It is a reward for the believer. In the Quran Allah (swt) describes good and noble company as a reward for believers in the hereafter. He says:
وَمَن يُطِعِ اللَّهَ وَالرَّسُولَ فَأُولَٰئِكَ مَعَ الَّذِينَ أَنْعَمَ اللَّهُ عَلَيْهِم مِّنَ النَّبِيِّينَ وَالصِّدِّيقِينَ وَالشُّهَدَاءِ وَالصَّالِحِينَ ۚ وَحَسُنَ أُولَٰئِكَ رَفِيقًا
And whoever obeys Allah and the Messenger – those will be with the ones upon whom Allah has bestowed favor of the prophets, the steadfast affirmers of truth, the martyrs and the righteous. And excellent are those as companions. (Q 4:69)
This verse reminds us of what every believer should pray for. It is a verse to recite often as a reminder of the real priorities of life on earth. Death as a Muslim and the company of the righteous are the fruits of a life lived in obedience to Allah (swt).
Sources: Āyatullāh Nāsir Makārim Shirāzī (Ed.), Tafsīr-e Namūneh.