Planets stay in orbit due to the gravity of the sun. The sun is much bigger and has greater mass compared to planets. This causes the sun to have a greater gravitational pull on planets.
Centripetal force is required to keep objects in a circular motion. This force is provided by the gravitational force of attraction between the planets and the sun. The planets revolve at great speeds around the sun. They would continue to move in a straight line were it not for the sun. The gravity of the sun causes a change in direction and makes the planets move in elliptical orbits instead of moving in a straight line.