I assume you are not interested in fairly common cases of a new country becoming independent and the old country recognising that. An example might be section 2 of the Canada Act 1982 passed by the UK parliament at the request of the Canadian government, which said
No Act of the Parliament of the United Kingdom passed after the
Constitution Act, 1982 comes into force shall extend to Canada as part
of its law.
More interesting cases are those where the agreement is with a third country aimed at maintaining a balance of power and preventing an overly powerful state emerging. These are rare as they are clear limitations of future sovereignty. For example, there are rumours that Thatcher and Mitterrand had misgivings over German reunification (they liked Germany so much that they wanted two of them), but there was nothing they could do.
So you may need to go further back for actual examples: one was at the end of the War of the Spanish Succession where the kings of France and Spain renounced any claims to each other then and in future (they were close family so there was a chance one would inherit from the other), and then agreed this with other countries, such as in the France/Great Britain treaty of Utrecht in 1713 which said
Now whereas it is provided and settled by the preceding Renunciation
(which is always to have the force of a pragmatic, fundamental, and
inviolable Law) that at no time whatever either the Catholic King
himself, or any of his lineage, shall seek to obtain the Crown of
France, or ascend the Throne thereof; and by reciprocal Renunciations
on the part of France and by Settlements of the Hereditary Succession
there, tending to the same purpose, the Crowns of France and Spain are
so divided and separated from each other, that the aforesaid
Renunciations, and the other Transactions relating thereto, remaining
in force, and being truly and faithfully observed, they can never be
joined in one
and a similar provision in the Spain/Great Britain treaty and then many other treaties that France and Spain signed with the Holy Roman Empire and others.