Hadithcore
Sahih Muslim, 532
sahih

Jundub reported:

I heard from the Messenger of Allah (ﷺ) five days before his death and he said: I stand acquitted before Allah that I took any one of you as friend, for Allah has taken me as His friend, as he took Ibrahim as His friend. Had I taken any one of my Ummah as a friend, I would have taken Abu Bakr as a friend. Beware of those who preceded you and used to take the graves of their prophets and righteous men as places of worship, but you must not take graves as mosques; I forbid you to do that.

حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ، - وَاللَّفْظُ لأَبِي بَكْرٍ - قَالَ إِسْحَاقُ أَخْبَرَنَا وَقَالَ أَبُو بَكْرٍ، حَدَّثَنَا زَكَرِيَّاءُ بْنُ عَدِيٍّ، عَنْ عُبَيْدِ اللَّهِ بْنِ عَمْرٍو، عَنْ زَيْدِ بْنِ أَبِي أُنَيْسَةَ، عَنْ عَمْرِو بْنِ مُرَّةَ، عَنْ عَبْدِ اللَّهِ بْنِ الْحَارِثِ النَّجْرَانِيِّ، قَالَ حَدَّثَنِي جُنْدَبٌ، قَالَ سَمِعْتُ النَّبِيَّ صلى الله عليه وسلم قَبْلَ أَنْ يَمُوتَ بِخَمْسٍ وَهُوَ يَقُولُ ‏

‏ إِنِّي أَبْرَأُ إِلَى اللَّهِ أَنْ يَكُونَ لِي مِنْكُمْ خَلِيلٌ فَإِنَّ اللَّهَ تَعَالَى قَدِ اتَّخَذَنِي خَلِيلاً كَمَا اتَّخَذَ إِبْرَاهِيمَ خَلِيلاً وَلَوْ كُنْتُ مُتَّخِذًا مِنْ أُمَّتِي خَلِيلاً لاَتَّخَذْتُ أَبَا بَكْرٍ خَلِيلاً أَلاَ وَإِنَّ مَنْ كَانَ قَبْلَكُمْ كَانُوا يَتَّخِذُونَ قُبُورَ أَنْبِيَائِهِمْ وَصَالِحِيهِمْ مَسَاجِدَ أَلاَ فَلاَ تَتَّخِذُوا الْقُبُورَ مَسَاجِدَ إِنِّي أَنْهَاكُمْ عَنْ ذَلِكَ ‏

‏ ‏.‏

Isnad

10 transmitters
  1. 1Abu Bakr bin Abi ShaybaKufa · d. ~235 AH
  2. 2Ishaq bin Ibrahim bin Muhammadal-Basra · d. 253 AH
  3. 3Ishaq bin Shahyn al-Wastial-Wasit · d. after 250 AH
  4. 4Abu Bakr bin Abi UvaisMedina · d. 202 AH
  5. 5Zakaria bin 'Ady bin Zaraynal-Kufa,Baghdad · d. ~212 AH
  6. 6'Ubaidullah bin 'Umar al-QawaririBasra,Baghdad · d. ~235 AH
  7. 7Zayd bin Abi AnisaRaha,Kufa · d. ~124 AH
  8. 8'Amr bin Murrah bin 'Abdullahal-Kufa · d. 112 AH or before
  9. 9'Abdullah bin al-Harithal-Kufa
  10. 10Jundab bin 'Abdullah al-BajliMedina/Kufa/Basra · d. ~76 AH
References2 variants
In-Book Reference
Book 5, Hadith 28
USC-MSA web (English) reference
Book 4, Hadith 1083 (deprecated numbering scheme)