Is there a direct relationship between the eccentricity of a planet's orbit and its distance from the sun?
Yes, there is a direct relationship between orbital eccentricity and distance from the Sun.
A planet, or other object, in orbit around the Sun is basically constrained by Kepler's three laws.
The first law states that the orbit is an ellipse with the sun at one of the focii.
The second law states that the planet sweeps out an arc of a fixed area for a given time interval.
The third law states that the square of the orbit period in years is equal to the cube of the semi major axis in astronomical units.
The eccentricity defines the shape of the ellipse. Given the semi-major axis distance
The orbits of most of the planets have a small eccentricity and are nearly circular so their distance from the sun doesn't vary much. The orbits of comets have a high eccentricity so their distance from the sun varies significantly over the orbit.