The Earth is acted upon by the gravitation of the Sun though it does not fall into the Sun. Why?
The gravitational force is responsible for providing the necessary centripetal force. The Earth is also moving tangentially and the Sun’s gravity pulls Earth towards itself, hence changing the trajectory of the Earth. But due to tangential movement of the Earth in Sun’s frame, the Earth does not fall into the Sun.