Language:
كتاب فضائل أصحاب النبى صلى الله عليه وسلم
62
Companions of the Prophet
(5)
Chapter: "If I were to take Khalil ..."
(5)
باب قَوْلِ النَّبِيِّ صلى الله عليه وسلم ‏"‏ لَوْ كُنْتُ مُتَّخِذًا خَلِيلاً ‏"‏ قَالَهُ أَبُو سَعِيدٍ

Narrated Ibn `Abbas:

While I was standing amongst the people who were invoking Allah for `Umar bin Al-Khattab who was lying (dead) on his bed, a man behind me rested his elbows on my shoulder and said, "(O `Umar!) May Allah bestow His Mercy on you. I always hoped that Allah will keep you with your two companions, for I often heard Allah's Messenger (ﷺ) saying, "I, Abu Bakr and `Umar were (somewhere). I, Abu Bakr and `Umar did (something). I, Abu Bakr and `Umar set out.' So I hoped that Allah will keep you with both of them." I turned back to see that the speaker was `Ali bin Abi Talib.

حَدَّثَنِي الْوَلِيدُ بْنُ صَالِحٍ، حَدَّثَنَا عِيسَى بْنُ يُونُسَ، حَدَّثَنَا عُمَرُ بْنُ سَعِيدِ بْنِ أَبِي الْحُسَيْنِ الْمَكِّيُّ، عَنِ ابْنِ أَبِي مُلَيْكَةَ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ إِنِّي لَوَاقِفٌ فِي قَوْمٍ، فَدَعَوُا اللَّهَ لِعُمَرَ بْنِ الْخَطَّابِ وَقَدْ وُضِعَ عَلَى سَرِيرِهِ، إِذَا رَجُلٌ مِنْ خَلْفِي قَدْ وَضَعَ مِرْفَقَهُ عَلَى مَنْكِبِي، يَقُولُ رَحِمَكَ اللَّهُ، إِنْ كُنْتُ لأَرْجُو أَنْ يَجْعَلَكَ اللَّهُ مَعَ صَاحِبَيْكَ، لأَنِّي كَثِيرًا مِمَّا كُنْتُ أَسْمَعُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ كُنْتُ وَأَبُو بَكْرٍ وَعُمَرُ، وَفَعَلْتُ وَأَبُو بَكْرٍ وَعُمَرُ، وَانْطَلَقْتُ وَأَبُو بَكْرٍ وَعُمَرُ‏.‏ فَإِنْ كُنْتُ لأَرْجُو أَنْ يَجْعَلَكَ اللَّهُ مَعَهُمَا‏.‏ فَالْتَفَتُّ فَإِذَا هُوَ عَلِيُّ بْنُ أَبِي طَالِبٍ‏.‏
Reference : Sahih al-Bukhari 3677
In-book reference : Book 62, Hadith 27
USC-MSA web (English) reference : Vol. 5, Book 57, Hadith 26
  (deprecated numbering scheme)