عَنْ أَبِي مَرْثَدٍ الْغَنَوِيِّ رَضِيَ اللَّهُ عَنْهُ سَمِعَ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يَقُولُ: ((لَا تُصَلُّوا إِلَى القُبُورِ وَلَا تَجْلِسُوا عَلَيْهَا (وَفِي لَفْظٍ) لَا تَجْلِسُوا عَلَى القُبُورِ وَلَا تُصَلُّوا عَلَيْهَا))
It is narrated from Sayyiduna Abu Marthad Ghanawi, may Allah be pleased with him, that the Messenger of Allah, peace and blessings be upon him, said: Do not pray facing towards graves, nor sit upon them. In another narration it is stated: Do not sit upon graves, nor pray upon them.