Authentic Supplication Number 156.

Jabir  said: the Prophet  offered the fineral prayer of 'Ashamata 'An-Najashi and said four takbeers (173).

Footnotes.
(173) It has been established through authentic ahadeeth that the Prophet  prayed the funeral prayer with 4 (according to most reports), 5, and up to nine takbeeras. Whichever a person does is acceptable; however, it is better to alternate between them. Just as it is better to alternate between the various opening suplications in the prayer, the various forms of tashahhud, and the various forms of 'As-salat 'Al-'Ibraheemiyya.

Reporters.
Reported in Saheeh Al-Bukhari #418 in the book of funerals in Volume 2 of Muhammad Muhsin Khan's translation.