1. Mass: The more massive an object is, the stronger its gravitational pull. This is why planets orbit stars, and not the other way around – stars are significantly more massive.
2. Distance: The force of gravity weakens with distance. The further apart two objects are, the weaker the gravitational force between them. This is why the Earth orbits the Sun, but is not pulled directly into it.
Essentially, the more massive an object is, and the closer it is to another object, the stronger the gravitational attraction between them.