The Prophet (may Allah's peace and blessings be upon him) forbade sitting on the graves. He also forbade praying while facing the graves if the grave lies in the direction of the Qiblah for the praying person because this is one of the means leading to polytheism.