The force of gravity is what keeps planets from floating away into space. Gravity is the invisible force that pulls objects towards each other, so the strong gravitational pull of a planet keeps it in its orbit around a star like the sun. This gravitational pull also keeps the planet's moons in orbit around it. Without gravity, planets and other celestial bodies would simply drift off into space.