We know there are stellar systems with large jovian planets near the star. The first extrasolar planet found around a star is 51-Peg, which is such a Jupiter sized planet very close to the star. There are a fair number of these "torch jovian" planets. As a result the solar system is just one particular configuration of planets.
There was an old model that assumed a protoplanetary disk that was thin near the star, thick further out and thinning further out. This was meant to explain the distribution of planetary masses in the solar system. Then with radiation from the star the volatile gasses are pushed further out leaving silicon to iron material behind that forms rocky planets. There is some reason to think stellar radiation can push gasses out if they are not locked into large jovian planets. However, the model of the protoplanetary disk is regarded now as not universal.
I read a while back a hypothesis on how the solar system has such small planets close to the sun. The idea is that early on there were two Neptune-sized planets that either collided or by mutual gravitation caused one to be slung out of the system and one fell into the sun. This left rocky material left close to the sun to form Mercury, Venus, Earth and Mars, also with maybe Ceres and asteroids. The early solar system was probably chaotic and violent, as the moon is now thought to be the result of a Mars sized planet that collided with the proto-earth.