Baseball Reference counts the 2004 season as Bonds being 39. He turned 40 on July 24th that year and hit 20 home runs between then and the end of the season. He did hit 59 in the 3 seasons that began after he turned 40.