The spacecraft farthest away from Earth is Voyager 1. But that's not necessarily the longest distance traveled. If you accept the distance traveled while in orbit, a spacecraft can rack up a lot of miles while staying close to Earth.
Let's try this for Helios I:
launched in 1974, so 42 years ago. 367.920 hours, 1.324 *109 seconds, at 45 km/s this is 59 *109 km traveled, much further than Voyager's 19 *109 km.
The Helios probes are in an eccentric probe. Assuming a speed of 70 km/s at perihelion and 30 km/s at aphelion (close to Earth's speed), a straight average is 45 km/s.
A better value can be calculated by finding its orbital period and the length of one orbit, I'm having some trouble figuring out how to find that length.