The Sun’s gravity pulls the Earth. Without it, the Earth would fly straight off, instead of around the Sun. So, it is a combination of the gravity of the Sun, and the weight and speed of the Earth. Try taking a yo-yo and spinning around your head by the string. The string, or the Sun’s gravity, holds it close, and if you release the string, bye-bye yo-yo.