Gravitational force of attraction formula(F)=(G×m1×m2)/r^2
From this formula, G= universal gravitational constant. m1 and m2 are masses. r= distance between the two masses.
Thus the force of attraction between the two bodies is inversely related to the square of the distance between them.
I.e. as the distance increases, the force decrease vice versa.