Since gravitational force is a conservative force, the amount of work done to move an object between two points in the gravitational field in which it resides is independent of the path taken. Thus, similar to the gravitational field, a gravitational potential energy function can be defined, which depends only on spatial coordinates.
Consider a mass gravitationally bound to another object. For example, the Earth is gravitationally bound to the Sun’s gravitational field. The potential energy of the Earth in the Sun’s gravitational field is defined such that its value is negative close to the Sun and increases to zero at large distances from the Sun.
Since the Earth and the Sun are not special cases, the result can be generalized for any two objects. Thus, under the influence of gravity, all masses fall from a higher to lower potential energy while their kinetic energies increase. Hence, the definition is consistent with the conservation of energy principle. If the total energy of a system is positive, it is not gravitationally bound.
The magnitude of the potential energy decreases with the distance between the two objects. It is inversely proportional to the distance because of the inverse-square dependence of the gravitational force on the distance.