Yes the law of gravity is modified. Before a more detailed answer can be given, the problem has to be clarified.

You refer to the gravitational effects between two masses. So let us consider two masses in an otherwise empty space. Let us further assume one mass to be "large" and the other mass to be a "test particle". Then, according to general relativity, you have to solve the Einstein equations for the large mass. Assuming that it is spherically symmetric and non-rotating (and not charged) you arrive at the Schwarzschild solution for the spacetime metric. From this you can find an effective potential for the motion of the test particle. You have a deviation from the Newtonian effective potential for small values of \(r\).

You also refer to the expansion of the universe. The simplest modification to take this into account in the above setup is to consider the Einstein equation with cosmological constant. Solving for the spacetime metric and finding the effective potential will now yield an additional deviation for large \(r\).

Qualitatively it could be said that for not too large \(r\) the expansion of spacetime is mitigated by the large mass, but for larger \(r\) the expansion wins. The relevant length scale here is \(1/\sqrt\Lambda\), with \(\Lambda\) the cosmological constant.