Jundab reported,

I heard the Prophet ﷺ say, five days before he died, "I declare before Allah that I have taken none of you as an intimate friend, for Allah the Exalted has taken me as His intimate friend, just as He took Ibrahim as an intimate friend. Had I been to take an intimate friend from my community, I would have taken Abu Bakr as such. Beware, those who came before you used to take the graves of their prophets and righteous ones as places of worship. Beware, do not take graves as places of worship. I forbid you from doing so."

Azami 8370

Sahih

عن جندب قال

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

الأعظمي 8370صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Stories of the prophets
Chapter
Ibrahim and his sons, peace be upon them
Section
Ibrahim عليه السلام is the Khalil of Allah
Numbering
Jami al-Kamil 8370 (2nd edition)
Azami 8370