In nature there are only four known fundamental forces: the strong nuclear force, the weak nuclear force, the electromagnetic force, and gravity. The strong and weak nuclear forces are only important on very tiny spatial scales, roughly one one hundred trillionth of an inch (that's 0.000000000000001 inches!). They couldn't be responsible, because they operate on such small scales and the gas cloud that formed the solar system, the solar nebula, was HUGE (far larger than the solar system is today).

The next possibility to consider is the electromagnetic force, which causes opposite charges to attract and like charges to repel. However, the solar nebula was basically neutral as it was forming (it had no charge bias). The electromagnetic force thus couldn't have caused the solar nebula to collapse either.

The only force left is the one that (we hope!) popped into your head to begin with, because gravity is the force that controls almost everything important in astronomy. The gravitational attraction of the various particles of gas and dust in the solar nebula to each other caused the entire cloud to collapse into the solar system we know today.