Sha'bi reported that the Messenger of Allah (ﷺ) observed prayer over a grave after the dead was buried and he recited four takbirs over him. Shaibani said
I said to Sha'bi: Who narrated it to you? He said: An authentic one, 'Abdullah b. 'Abbas. This is the word of a hasan hadith. In the narration of Ibn Numair (the words are): The Messenger of Allah (ﷺ) went to the grave which had been newly prepared and prayed over it, and they also prayed who were behind him and he recited four takbirs. I said to 'Amir: Who narrated it to you? He said: An authentic one who saw him, i e. Ibn 'Abbas.
This hadith has been narrated through another chain of transmitters, but in one of them (these words are found)
" The Apostle of Allah (ﷺ) recited four takbirs."
The hadith as narrated by Shaibani has been narrated through another chain of transmitters.
Anas reported that the Messenger of Allah (ﷺ) observed prayer on the grave.
It is narrated on the authority of Abu Huraira that a dark-complexioned woman (or a youth) used to sweep the mosque. The Messenger of Allah (ﷺ) missed her (or him) and inquired about her (or him). The people told him that she (or he) had died. He asked why they did not inform him, and it appears as if they had treated her (or him) or her (or his) affairs as of little account. He (the Holy Prophet) said
Lead me to her (or his) grave. They led him to that place and he said prayer over her (or him) and then remarked: Verily, these graves are full of darkness for their dwellers. Verily, the Mighty and Glorious Allah illuminates them for their occupants by reason of my prayer over them.
It is narrated on the authority of 'Abd al-Rahman b. Abu Laila that Zaid used to recite four takbirs on our funerals and he recited five takbirs on one funeral. I asked him the reason (for this variation), to which he replied
The Messenger of Allah (ﷺ) recited thus.