Ayesha reported,

I used to hear that no prophet dies until he is given a choice between this world and the hereafter. During the illness in which he passed away, I heard the Prophet ﷺ, his voice grown hoarse, reciting, "with those whom Allah has favored of the prophets, the truthful, the martyrs, and the righteous. And excellent are those as companions" [Nisa 4:69]. I knew then that he had been given the choice.

Muslim 6295

Sahih

و حدثنا محمد بن المثنى وابن بشار واللفظ لابن المثنى قالا حدثنا محمد بن جعفر حدثنا شعبة عن سعد بن إبراهيم عن عروة

عن عائشة قالت

كنت أسمع أنه لن يموت نبي حتى يخير بين الدنيا والآخرة قالت فسمعت النبي ﷺ في مرضه الذي مات فيه وأخذته بحة يقول {مع الذين أنعم الله عليهم من النبيين والصديقين والشهداء والصالحين وحسن أولئك رفيقا} قالت فظننته خير حينئذ

مسلم 6295صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Virtues of the Companions, may Allah be pleased with them
Chapter
Virtue of Ayesha, may Allah be pleased with her
Numbering
Darussalam 6295
Muslim 6295