Sayyiduna Abu Marthad al-Ghanawi (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings be upon him) say: "Do not sit facing graves, and do not pray facing them."
Hadith Referenceالمعجم الكبير للطبراني / باب الكاف / 16483