I heard that never a prophet dies until he is given an option to opt the life of (this) world or that of the Hereafter. She further said: I heard Messenger of Allah ﷺ say in his last illness in which he' died. I heard him saying in gruffness of the voice: Along with those persons upon whom Allah bestowed favours from amongst the Apostles, the testifiers of truth, the martyrs, the pious and goodly company are they (iv. 69). (It was on bearing these words) that I thought that he had been given choice (and he opted to live with these pious persons in the Paradise). (Using translation from Muslim 2444c)
أَسْمَعُ أَنَّهُ لَنْ يَمُوتَ نَبِيٌّ حَتَّى يُخَيَّرَ بَيْنَ الدُّنْيَا وَالْآخِرَةِ قَالَتْ فَسَمِعْتُ النَّبِيَّ ﷺ فِي مَرَضِهِ الَّذِي مَاتَ فِيهِ وَأَخَذَتْهُ بُحَّةٌ يَقُولُ {مَعَ الَّذِينَ أَنْعَمَ اللهُ عَلَيْهِمْ مِنَ النَّبِيِّينَ وَالصِّدِّيقِينَ وَالشُّهَدَاءِ وَالصَّالِحِينَ وَحَسُنَ أُولَئِكَ رَفِيقًا} [النساء 69] قَالَتْ فَظَنَنْتُ أَنَّهُ خُيِّرَ حِينَئِذٍ قَالَرَوْحٌ إِنَّهُ خُيِّرَ بَيْنَ الدُّنْيَا وَالْآخِرَةِ