It is narrated from Sayyiduna Abu Sa'id (may Allah be pleased with him): "The Prophet of Allah (peace and blessings be upon him) forbade building structures over graves, sitting on them, or praying on them." Imam Abu Ya'la recorded it, and the wording is his, while Imam Ibn Majah reported it in abridged form; both routes are narrated through al-Qasim bin Mukhaymirah from Sayyiduna Abu Sa'id (may Allah be pleased with him), although his hearing from him is not established. Imam Muslim and other muhaddithin also recorded it from the hadith of Sayyiduna Wathilah bin al-Asqa' (may Allah be pleased with him).
Hadith Gradingمحدثین:سكت عنه البوصيري، إسناده ضعيف؛ لانقطاعه بين القاسم بن مخيمرة وأبي سعيد، وأصل النهي في صحيح مسلم
Hadith Takhrij«القاسم بن مخيمرة: ثقة فاضل، لم يسمع من أبي سعيد كما نص البوصيري؛ والنهي عن الجلوس على القبور والصلاة إليها في صحيح مسلم من حديث جابر وأبي مرثد» «أخرجه سنن ابن ماجه برقم: 1564، وأخرجه مجمع الزوائد ومنبع الفوائد برقم: 3715، 3716»