IN-28
Invocation to be recited when placing the dead in his grave
Bismillaahi wa 'alaa sunnati Rasoolillaahi.
With the Name of Allah and according to the Sunnah of the Messenger of Allah.
Reference: Abu Dawud 3/314 with an authentic chain. Ahmad also recorded it with the wording: With the Name of Allah, and according to the religion of the Messenger of Allah. Its chain is also authentic.
Invocation to be recited after burying the dead
Allaahum-maghfir lahu Allaahumma thabbithu.
O Allah, forgive him. O Allah, strengthen him.
Reference: The Prophet (SAW) used to stop after burying the dead and say to the people: "Ask Allah to forgive your brother and pray for him to be strengthened, for indeed he is now being questioned." Abu Dawud 3/315, and Al-Hakim 1/370 who graded it authentic and Ath-Thahabi agreed
Invocation for visiting the graves
Assalaamu 'alaykum 'ahlad-diyaari, minal-mu'mineena walmuslimeena, wa 'innaa 'in shaa' Allaahu bikum laahiqoona [wa yarhamullaahul-mustaqdimeena minnaa walmusta'khireena] 'as'alullaaha lanaa wa lakumul- 'aafiyata.
Peace be upon you, people of this abode, from among the believers and those who are Muslims , and we , by the Will of Allah , shall be joining you . [May Allah have mercy on the first of us and the last of us] I ask Allah to grant us and you strength.
Reference: Muslim 2/671, Ibn Majah 1/494, the portion brackets is from Muslim 2/671