Abu Umamah Al-Bahily
reported that the Messenger of Allah (peace be upon him) said:
When anyone of you dies and you have leveled the earth over them, let one of you stand (Part No. 7; Page No. 328) at the head of their grave and then say, "O So-and-so, son of So-and-so [name of the mother]," for they will hear it even if they do not reply. Then let them say a second time, "O So-and-so, son of So-and-so [name of the mother]," whereupon the deceased will sit up (in their grave). Then let them say, "O So-and-so, son of So-and-so [name of the mother]!" Upon this, the deceased will say, "Instruct me, may Allah be merciful to you," although you cannot hear it. Then let them say, "Remember the state in which you left this world, which is your witnessing that there is no Ilah (god) except Allah, and that Muhammad is His Servant and Messenger; that you are pleased with Allah as your Lord, Islam as your religion, Muhammad as your Prophet, and the Qur'an as your guide. Upon this, Munkar and Nakir (the two angels who test the faith of the dead in their graves) will withdraw saying, "Let us go; there is no need for us to tarry here, for indeed they have been prompted to say their argument." Indeed Allah will Himself defend the deceased against the two of them (angels)." A man said, "O Messenger of Allah, what if their mother's name is not known?" He replied: "Then let them affiliate them (deceased) to their mother Hawwa' (Eve)."
The above Hadith which urges people
to remind the soul of the deceased to say: “La ilaha illa Allah (there is no god but Allah)” was not authentically reported from the Prophet (peace be upon him), and thus it is not permissible to act in accordance to it. It was authentically reported that the Prophet (peace be upon him) and his Sahabah (Companions of the Prophet) would stand by the grave after burying a deceased and he would say to them:
Ask Allah to forgive your brother and supplicate for him to be steadfast, because he is now being questioned.
Accordingly, it is Mashru` (Islamically prescribed) after burying a dead person to ask forgiveness, mercy and steadfastness for them acting in accordance with the Hadith mentioned above.