Planets formed in the Solar Nebula from the slow accretion of small dust particles (via electrostatic forces) into 1-10 km size planetesimals.
Formation of the Terrestrial Planets
In 100,000 years, planetesimals up to 10 km in size would have formed.
The accretion continues, but fueled by the gravitational attraction of
the biggest planetesimals: The big keep getting bigger swallowing
up smaller planetesimals near its orbit. The growing young planet
absorbs the mass and the orbital energy of all the smaller objects,
circularizing (averaging out) the final orbit.
Perhaps a hundred Planetary Embryos form, with Moon masses
(1/10th Earth). They interfere with each other's orbits. This mixes
up the differing planet chemistries created based on distances from
the Sun. More importantly, the embryos collide! This process creates
the few final planets, when all embryos have been
assimilated in 10 m.yrs.
The Asteroid Belt. Jupiter's gravity causes an extra boost in planetesimal velocities. When asteroids collide, the destroy each other rather than stick together and no final planet can accrete from the material spread through out the belt.
Formation of the Jovian Planets
Jupiter and Saturn contain much of the lighter elements found in the
Sun (H, He). They accumulated via rocky planetesimals, but once
they were 10-20x Earth, their mass attracted the light elements,
Jupiter an additional ~300x Earth and Saturn an additional ~100x Earth mass.
Uranus and Neptune, being much farther out in
the Solar System, may have formed their central cores too late, after
most of the H and He gas in the Solar Nebula had been lost. They only
accumulated a small amount of gas beyond their rocky cores (final masses
of just 14.5 and 17x Earth).
The Oort Cloud likely formed at the distance of Uranus and Neptune, but the comets were thrown out through gravitational interactions. The Kuiper Belt was untouched, out beyond Neptune, and represent un-accretted, very icy and slow moving planetesimals. Recent findings on Planet Formation