The interaction between gravitational pull of sun and earth's inertia keeps the planets stable in their orbits.
EXPLANATION:
Inertia means change in center of gravity. Newton concluded that gravity and inertia, when combined helps to keep the Earth around the orbit of the sun and it also keeps the moon in Earth's orbit. Everything has a gravitational pull that may be big or small.
Like all planets, Earth has inertia because of which it resists change to its direction and speed of movement. But because of the sun's gravitational pull, earth remains in its orbit. Also, Earth pulls moon towards itself because of gravity, the moon doesn't move straight and because of inertial effect, the moon keeps moving ahead in the system.