When the Prophet (pbuh) used to place the deceased in the grave, he would supplicate in the following manner
‘In the Name of Allah, we created you from it (the earth), and to it, we shall return you, and from it, we shall bring you forth once again.’ In the Name of Allah, upon the path of Allah, and in adherence to the religion of Allah’s Messenger.”
After the burial, he used to say to those around:
‘Pray for forgiveness for your brother and ask for steadfastness on his behalf in adherence to his religion.’ Then, at the head of the grave, he would recite the beginning and the end of Surah al-Baqarah.
When visiting the graves, he used to say:
‘Peace be upon you, O believers and inhabitants of the Muslim land! Insha’Allah, we will join you. We wish well for both ourselves and you. You are our predecessors, and we will follow. May God have mercy on those who went before and those who will come after.’”