The earth is acted upon by gravitation of Sun, even though it does not fall into the Sun. Why?
The earth is acted upon by the gravitation of sun, this gravitational force provides needed centripetal force to the earth.
Centripetal force is required to change the direction of velocity of the earth.
Because of this force the earth maintains its separation from sun; otherwise, it will move in a straight-line tangent to the current orbit.
The gravitational pull of the sun forbids earth to go away from it.