That's true.
Newton's law of universal gravitation says that the gravitational
force between two objects is
F = G · M₁ · M₂ / D² .
There's no note under the equation that says "only up to
this certain distance, and zero any farther than that".
The equation is true no matter how gigantic the distance
is between the objects.