The Moon orbits the Earth in a circular orbit. The Earth orbits the Sun in an orbit that is almost circular. In general, the planets orbit the Sun in elliptical orbits, which are slightly squished circles. In each case, an object orbits a much bigger object. The centripital force on the orbiting object is due to the force of gravitational attraction between it and larger object.
To stay in orbit around the Sun at a particular distance, and planet must move at a particular speed. If the speed is too low, the planet will spiral into the Sun. If it is too high, it will sly off of its orbit and move away from the Sun.
The further a planet is from the Sun, the less its speed is as it moves. This is because the gravity lessens the greater the distance from the Sun. The speed needs to be lower, else the planet would fly off its orbit.
The further a planet is from the Sun, the longer it takes to make a complete orbit, because the circumference of the orbit is greater.