This is described by Newton's Law of Universal Gravitation:
F = G * (m1 * m2) / r^2
Where:
* F is the force of gravity
* G is the gravitational constant
* m1 and m2 are the masses of the two objects
* r is the distance between their centers
As you can see from the equation, the force of gravity is inversely proportional to the square of the distance between the objects. This means that if you double the distance between them, the gravitational force will decrease to one-fourth its original strength.
So, as the distance increases, the force of attraction weakens significantly.