Counter intuitive it seems that in some cases gravity results in a higher orbit and greater distance. For example the moon is attracted to the Earth but because it gets a higher speed it ends up farther away from the Earth.
Also our solar system could have been in early days much smaller (according to Nice-model), but caused by gravity of Jupiter and Saturn the outer planets were pushed farther from the sun although there must be an attraction involved between the planets what would suggest the get smaller instead of larger.
The Nice Model is a scenario for the dynamical evolution of the Solar System. [...] It proposes the migration of the giant planets from an initial compact configuration into their present positions, long after the dissipation of the initial protoplanetary gas disk. [...] This planetary migration is used in dynamical simulations of the Solar System to explain historical events including the Late Heavy Bombardment of the inner Solar System, the formation of the Oort cloud, [etc]. [...]
Now are for example also comets gets higher orbits as they are attracted to the Sun? So in general, is gravity always causing larger distances between objects?