Jundab bin Abdullah reported,

I heard the Prophet ﷺ say, five days before he died, "I declare before Allah that I have not taken any of you as a close friend, for Allah Most High has taken me as His close friend, just as He took Ibrahim as His close friend. Had I been to take a close friend from my community, I would have taken Abu Bakr as my close friend." The hadith continues.

Azami 9837

Sahih

عن جندب بن عبد الله قال

سمعت النبي ﷺ قبل أن يموت بخمس وهو يقول: إني أبرأ إلى الله أن يكون لي منكم خليل، فإن الله تعالى قد اتخذني خليلا، كما اتخذ إبراهيم خليلا، ولو كنت متخذا من أمتي خليلا لاتخذت أبا بكر خليلا… الحديث.

الأعظمي 9837صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Virtues of the Companions and reports about them
Chapter
Virtues of Abu Bakr and his reports
Section
If the Prophet ﷺ had taken a close friend, it would have been Abu Bakr
Numbering
Jami al-Kamil 9837 (2nd edition)
Azami 9837