The reason is just mass, if you had more mass then the internal pressures become higher and whille the volume decreases the density increases.
A good example is Mars Vs Mercury. Even that Mars is a lot more massive then Mercury, since Mercury is more dense the result is that they both have a similar gravitical pull at the surface. If you had more mass to a object its gravitical pull will be increased resulting in the compression of materials resulting in a higher density.
Much more massive planets have been found, such as carbon like planets (literaly diamond) with densities around 3x the ones we have here on Earth.
Earth density is around 5.9g/cm3
Carbon like planets are around 20g/cm3
More massive and bigger planets have been found.
Since you excluded Black holes i'll have to say that neutron stars fit in your description... Or even White dwarfs stars (dead stars)
Answering you question in a simple way. Being more massive means that that object had a bigger chance in atracting more gas during its formation, which means they would become gas planets and not rocky ones.