Gravity keeps things together. It is a force that attracts matter towards it. Anything with mass creates gravity, but the amount of gravity is proportional to the amount of mass. Therefore, Jupiter has a stronger gravitational pull than Mercury. Distance also affects the strength of the gravitational force. Therefore, the Earth has a stronger pull on us than Jupiter does, even though Jupiter is as big as over 1,300 Earths. While we are familiar with gravity's impact on us and on Earth, this force also has many effects on the entire solar system, too.
One of the most noticeable effects of gravity in the solar system is the orbit of the planets. The sun could hold 1.3 million Earths so its mass has a strong gravitational pull. When a planet tries to go past the sun at a high rate of speed, gravity grabs the planet and pulls it towards the sun. Likewise, the planet's gravity is trying to pull the sun towards it but can't because of the vast difference in mass. The planet keeps moving but is always caught up in the push-pull forces caused by the interaction of these gravitational forces. As a result, the planet begins orbiting the sun. The same phenomenon causes the moon to orbit around the Earth except its the Earth's gravitational force not the sun's that keeps it moving around us.
Just as the moon orbits the Earth, other planets have moons of their own. The push-pull relationship between the gravitational forces of the planets and their moons causes an effect known as tidal bulges. On Earth, we see these bulges as high and low tides because they occur over oceans. But on planets or moons without water, tidal bulges can occur over land. In some cases, the bulge created by gravity will be pulled back and forth because the orbit varies in its distance from the primary source of gravity. The pulling causes friction and is known as tidal heating. On Io, one of Jupiter's moons, the tidal heating has caused volcanic activity. This heating may also be responsible for volcanic activity on Saturn's Enceladus and liquid water underground on Jupiter's Europa.
Giant molecular clouds made up of gas and dust slowly collapse because of the inward pull of their gravity. When these clouds collapse, they form lots of smaller areas of gas and dust that will eventually collapse as well. When these fragments collapse, they form stars. Because the fragments from the original GMC stay in the same general area, their collapse causes stars to form in clusters.
When a star is born, all of the dust and gas not needed in its formation ends up trapped in the orbit of the star. The dust particles have more mass than the gas so they can begin to concentrate in certain areas where they come in contact with other dust grains. These grains are pulled together by their own gravitational forces and kept in orbit by the gravity of the star. As the collection of grains becomes bigger, other forces also begin to act upon it until a planet forms over a very long period of time.
Because many things in the solar system are held together thanks to the gravitational pull among its components, strong external gravitational forces could literally pull those components apart thus destroying the object. This happens with moons sometimes. For example, Neptune's Triton is being pulled closer and closer to the planet as it orbits. When the moon gets too close, perhaps in 100 million to 1 billion years, the planet's gravity will pull the moon apart. This effect might also explain the origin of the debris that makes up the rings found around all of the large planets: Jupiter, Saturn, and Uranus.