Language:
كتاب الدعوات
80  
Invocations
(29)
Chapter: The invocation of the Prophet (saws) "O Allah! The Highest Companion"
(29)
باب دُعَاءِ النَّبِيِّ صلى الله عليه وسلم ‏"‏ اللَّهُمَّ الرَّفِيقَ الأَعْلَى ‏"‏‏.‏
Sahih al-Bukhari 6348

Narrated `Aisha:

When Allah's Messenger (ﷺ) was healthy, he used to say, "No prophet dies till he is shown his place in Paradise, and then he is given the option (to live or die)." So when death approached him(during his illness), and while his head was on my thigh, he became unconscious for a while, and when he recovered, he fixed his eyes on the ceiling and said, "O Allah! (Let me join) the Highest Companions (see Qur'an 4:69)," I said, "So, he does not choose us." Then I realized that it was the application of the statement he used to relate to us when he was healthy. So that was his last utterance (before he died), i.e. "O Allah! (Let me join) the Highest Companions."

حَدَّثَنَا سَعِيدُ بْنُ عُفَيْرٍ، قَالَ حَدَّثَنِي اللَّيْثُ، قَالَ حَدَّثَنِي عُقَيْلٌ، عَنِ ابْنِ شِهَابٍ، أَخْبَرَنِي سَعِيدُ بْنُ الْمُسَيَّبِ، وَعُرْوَةُ بْنُ الزُّبَيْرِ، فِي رِجَالٍ مِنْ أَهْلِ الْعِلْمِ أَنَّ عَائِشَةَ ـ رضى الله عنها ـ قَالَتْ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يَقُولُ وَهْوَ صَحِيحٌ ‏"‏ لَنْ يُقْبَضَ نَبِيٌّ قَطُّ حَتَّى يَرَى مَقْعَدَهُ مِنَ الْجَنَّةِ ثُمَّ يُخَيَّرُ ‏"‏‏.‏ فَلَمَّا نَزَلَ بِهِ وَرَأْسُهُ عَلَى فَخِذِي، غُشِيَ عَلَيْهِ سَاعَةً، ثُمَّ أَفَاقَ فَأَشْخَصَ بَصَرَهُ إِلَى السَّقْفِ ثُمَّ قَالَ ‏"‏ اللَّهُمَّ الرَّفِيقَ الأَعْلَى ‏"‏‏.‏ قُلْتُ إِذًا لاَ يَخْتَارُنَا، وَعَلِمْتُ أَنَّهُ الْحَدِيثُ الَّذِي كَانَ يُحَدِّثُنَا، وَهْوَ صَحِيحٌ‏.‏ قَالَتْ فَكَانَتْ تِلْكَ آخِرَ كَلِمَةٍ تَكَلَّمَ بِهَا ‏"‏ اللَّهُمَّ الرَّفِيقَ الأَعْلَى ‏"‏‏.‏
Reference : Sahih al-Bukhari 6348
In-book reference : Book 80, Hadith 45
USC-MSA web (English) reference : Vol. 8, Book 75, Hadith 359
  (deprecated numbering scheme)