Praise be to Allah.
It is Sunnah for the one who places the deceased in the grave to say: “Bismillaah wa ‘ala sunnati Rasool-Illaah (or: wa ‘ala millati Rasool-Illaah) sall-Allaahu ‘alayhi wa sallam (In the name of Allaah and according to the Sunnah of the Messenger of Allaah (or: according to the religion of the Messenger of Allaah (peace and blessings of Allaah be upon him)).
This is narrated in the hadeeth of Ibn ‘Umar (may Allaah be pleased with him) who said that when the Prophet (peace and blessings of Allaah be upon him) placed the deceased in the grave he would say (and according to another version, he said: When you place your dead in the graves say:) “Bismillaah wa ‘ala sunnati Rasool-Illaah”; according to another report: “wa ‘ala millati Rasool-Illaah.”
This was narrated by Abu Dawood, 3213; al-Tirmidhi, 1046; Ibn Maajah, 1550; al-Haakim, 1353; classed as saheeh by al-Albaani in Ahkaam al-Janaa’iz, p. 192.
After completion of the burial it is Sunnah to pray for forgiveness for the deceased and pray for him to be made steadfast, because of the hadeeth of ‘Uthmaan ibn ‘Affaan (may Allaah be pleased with him) who said: When the Prophet (peace and blessings of Allaah be upon him) had finished burying the deceased he would stand over him and say: “Pray for forgiveness for your brother, and ask that he be made steadfast, for now he is being questioned.”
Narrated by Abu Dawood, 3221; classed as saheeh by al-Albaani in Ahkaam al-Janaa’iz, p. 198.
Standing over him means standing over his grave.
“and [said]: Pray for forgiveness for your brother” means: ask for forgiveness for him from Allaah, i.e., say: “O Allaah forgive him.”
“and ask that he be made steadfast” means: ask Allaah to make his tongue steadfast in answering the two angels, i.e., say: “O Allaah make him steadfast in speech.”
“for now he is being questioned” i.e., at that moment the two angels are coming to him, namely Munkar and Nakeer, so he is in the greatest need of prayers for forgiveness and steadfastness.