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.
سمعت النبي ﷺ قبل أن يموت بخمس وهو يقول: إني أبرأ إلى الله أن يكون لي منكم خليل، فإن الله تعالى قد اتخذني خليلا، كما اتخذ إبراهيم خليلا، ولو كنت متخذا من أمتي خليلا لاتخذت أبا بكر خليلا… الحديث.
Muslim narrated it in the Virtues of the Companions (532-23) via Abdullah bin Amr, from Zayd bin Abu Unaysa, from Amr bin Mura, from Abdullah bin Harith Najrani, who said, "Jundab told me, saying, 'I heard the Prophet ﷺ,'" and he mentioned it.