There are two groups of planets orbiting our sun. Large gas planets orbit at great distance from the sun. These planets are known as the giant or outer planets. Smaller rocky planets orbit at less distance from the sun. These planets are the inner planets.
Outer planets serve an important purpose. Because they are large, they have a relatively strong gravity, and this gravity deflects asteroids and comets away from the inner planets. Some of the asteroids and comets may be deflected into an outer planet, but that is OK since the outer planets have a very large mass compared to the asteroids and comets. An example of this is the crash of the Shoemaker-Levy comet with Jupiter in July 1994.
Some scientists believe the outer planets were influential in the formation of the inner planets. They are doing mathematical simulations to investigation their beliefs. Here are some results of this research.
The duo then studied observations of the 520 giant planets found outside our solar system. Only 19 of them reside outside the snow line, suggesting that most of the giant planets that may have formed outside the snowline have migrated too far inward to preserve the kind of slightly-dispersed asteroid belt needed to foster enhanced evolution of life on an Earth-like planet near the belt. Apparently, less than four percent of the observed systems may actually harbor such a compact asteroid belt.
These clues suggest that the orbits of giant planets were affected by a dynamical instability when the solar system was only about 600 million years old. As a result, the giant planets and smaller bodies scattered away from each other.