Do not sit on the graves and do not pray facing towards them.

Sahih Muslim Book 11 Hadith 126

Sahih Muslim #972 a

The Book of Prayer - Funerals 11:126

Abu Marthad al-Ghanawi reported Allah's Messenger (ﷺ) as saying:

Do not sit on the graves and do not pray facing towards them.

Chapter: Prohibition against sitting and praying on graves

Grade: Sahih