Mishkat al-Masabih

Abu Huraira said that God’s messenger prayed over a bier, then went to the grave and threw three handfuls of earth towards the head of the dead man. Ibn Majah transmitted it.

وَعَنْ أَبِي هُرَيْرَةَ: أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ صَلَّى عَلَى جَنَازَةٍ ثُمَّ أَتَى الْقَبْر فَحَثَا عَلَيْهِ مِنْ قِبَلِ رَأْسِهِ ثَلَاثًا. رَوَاهُ ابْنُ مَاجَه