Abu Marthad al-Ghanawi reported Allah's Messenger (ﷺ) as saying
Do not pray facing towards the graves, and do not sit on them.