The sun is a celestial body and has its inherent gravitational pull. It pulls the other platelets around it by virtue of this pull. If this pull is lost, the earth will drift away from the sun on its own path. The sun holds the earth towards it.
The earth constantly rotates on its axis which is also by virtue of its tilt and the pull of the sun. Every mass in the solar system has an inherent gravitational pull. The sun has its pull because of its magnetic core which pulls on the other planets around it keeping them in their respective orbits.