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

Narrated `Abdullah bin Abi Mulaika:

The people of Kufa sent a letter to Ibn Az-Zubair, asking about (the inheritance of) (paternal) grandfather. He replied that the right of the inheritance of (paternal) grandfather is the same as that of father if the father is dead) and added, "Allah's Messenger (ﷺ) said, ' If I were to take a Khalil from this nation, I would have taken him (i.e. Abu Bakr).

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