Language:
كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(83)
Chapter: The sickness of the Prophet (saws) and his death
(83)
بَابُ مَرَضِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَوَفَاتِهِ
Sahih al-Bukhari 4435

Narrated `Aisha:

Used to hear (from the Prophet) that no Prophet dies till he is given the option to select either the worldly life or the life of the Hereafter. I heard the Prophet (ﷺ) in his fatal disease, with his voice becoming hoarse, saying, "In the company of those on whom is the grace of Allah ..( to the end of the Verse )." (4.69) Thereupon I thought that the Prophet (ﷺ) had been given the option.

حَدَّثَنِي مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ، حَدَّثَنَا شُعْبَةُ، عَنْ سَعْدٍ، عَنْ عُرْوَةَ، عَنْ عَائِشَةَ، قَالَتْ كُنْتُ أَسْمَعُ أَنَّهُ لاَ يَمُوتُ نَبِيٌّ حَتَّى يُخَيَّرَ بَيْنَ الدُّنْيَا وَالآخِرَةِ، فَسَمِعْتُ النَّبِيَّ صلى الله عليه وسلم يَقُولُ فِي مَرَضِهِ الَّذِي مَاتَ فِيهِ وَأَخَذَتْهُ بُحَّةٌ يَقُولُ ‏{‏مَعَ الَّذِينَ أَنْعَمَ اللَّهُ عَلَيْهِمْ‏}‏ الآيَةَ، فَظَنَنْتُ أَنَّهُ خُيِّرَ‏.‏
Reference : Sahih al-Bukhari 4435
In-book reference : Book 64, Hadith 456
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 719
  (deprecated numbering scheme)