Ayesha reported,

The Messenger of Allah ﷺ, while he was in good health, used to say, "No prophet is ever taken in death until he is shown his place in Paradise, and then he is given the choice to live on or to depart."When he fell ill and the moment of his death drew near, his head was resting on Ayesha's thigh. He lost consciousness, then when he came to, he fixed his gaze toward the ceiling of the house and said, "O Allah, with the highest companions."Ayesha said, "I thought to myself, then he is not choosing to remain with us." And I realized this was the very matter he had been telling us about while he was in good health.

Azami 3516

Sahih

عن عائشة قالت

كان رسول الله ﷺ وهو صحيح يقول: إنه لم يقبض نبي قط حتى يرى مقعده من الجنة، ثم يحيا أو يخير. فلما اشتكى، وحضره القبض، ورأسه على فخذ عائشة غشى عليه، فلما أفاق شخص بصره نحو سقف البيت ثم قال: اللهم في الرفيق الأعلى فقلت: إذا لا يجاورنا، فعرفت أن حديثه الذي كان يحدثنا وهو صحيح.

الأعظمي 3516صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Dying person
Section
Among the distinctions of the prophets is that they are given the choice between remaining in this world and departing from it
Numbering
Jami al-Kamil 3516 (2nd edition)
Azami 3516