عَنْ عُرْوَةَ بْنِ الزُّبَيْرِ قَالَ: كَانَ بِالْمَدِينَةِ رَجُلَانِ أَحَدُهُمَا يَلْحَدُ وَالْآخَرُ لَا يَلْحَدُ. فَقَالُوا: أَيُّهُمَا جَاءَ أَوَّلًا عَمِلَ عَمَلَهُ. فَجَاءَ الَّذِي يَلْحَدُ فَلَحَدَ لِرَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ. رَوَاهُ فِي شَرْحِ السّنة
Translation

Ibn ‘Umar told that when the dead was placed in the grave the Prophet said, “In the name of God, by God’s grace, and following the religion of God’s messenger.” A version has “And following the sunna of God’s messenger.” Ahmad, Tirmidhi and Ibn Majah transmitted it, and Abu Dawud transmitted the second version.