Jundub reported: The Prophet, peace and blessings be upon him, said, “I am innocent before Allah of taking any of you as my best friend. Verily, Allah Almighty has taken me as His best friend, just as he took Abraham as His best friend. If I were to take anyone of my nation as a best friend, it would have been Abu Bakr. Verily, those before you would take the graves of their prophets and righteous as places of prayer. Do not take graves as places of prayer. I forbid you from doing so.”
Source: Ṣaḥīḥ Muslim 532
Grade: Sahih (authentic) according to Muslim
عن جندب عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ إِنِّي أَبْرَأُ إِلَى اللَّهِ أَنْ يَكُونَ لِي مِنْكُمْ خَلِيلٌ فَإِنَّ اللَّهَ تَعَالَى قَدِ اتَّخَذَنِي خَلِيلاً كَمَا اتَّخَذَ إِبْرَاهِيمَ خَلِيلاً وَلَوْ كُنْتُ مُتَّخِذًا مِنْ أُمَّتِي خَلِيلاً لاَتَّخَذْتُ أَبَا بَكْرٍ خَلِيلاً أَلاَ وَإِنَّ مَنْ كَانَ قَبْلَكُمْ كَانُوا يَتَّخِذُونَ قُبُورَ أَنْبِيَائِهِمْ وَصَالِحِيهِمْ مَسَاجِدَ أَلاَ فَلاَ تَتَّخِذُوا الْقُبُورَ مَسَاجِدَ إِنِّي أَنْهَاكُمْ عَنْ ذَلِكَ
532 صحيح مسلم كتاب المساجد ومواضع الصلاة باب النهي عن بناء المساجد على القبور واتخاذ الصور فيها والنهي عن اتخاذ القبور مساجد