A government bill aimed at ensuring goods continue to be traded without restrictions throughout the UK is expected to pass into law.
The Commons has approved changes made by the Lords to the Internal Market Bill (IMB), ending weeks of arguments.
If peers now give it their final backing, it will become law.
The row - separate to the UK-EU talks on a post-Brexit trade deal - centred on the rights of devolved governments to vary standards on goods.
The UK left the EU in January but has continued to follow the same rules and regulations during what is known as the transition period, which lasts until 31 December.
The controversy was over the role of the Northern Irish, Scottish and Welsh governments in setting trade policy, and Westminster's direct spending powers.
The devolved administrations said the IMB - which sets out how "frictionless" trade can continue within the UK from next year - would over-centralise trade policy and undermine the convention that they must be consulted by the UK government on issues that have an impact on their autonomy.
The Lords voted for more flexibility in the IMB to allow devolved administrations to set standards for goods - which the UK government initially rejected.
But ministers then made some concessions and peers approved the bill on Tuesday.
MPs approved it again on Wednesday, leaving only a final Lords vote before it goes into law.
Business Minister Paul Scully said he was "delighted" at the "consensus" achieved, telling the Commons: "I'm immensely grateful to colleagues across both Houses for their constructive discussions with the government."
For Labour, shadow business minister Lucy Powell said the bill had been improved, although it was "far from perfect".
But the Scottish government said the bill still represented "a deliberate act of constitutional sabotage".
It added that "the small concessions made by the UK government do not go nearly far enough to mitigate the damage the bill will do to devolution, and Scottish interests".
The Welsh government has announced it intends to take the UK government to court, with the Scottish government backing the move.
When first published in September, the IMB was controversial mainly because it included clauses giving the UK government powers to break international law.
These were in particular relation to an agreement between the UK and EU on future trade between Northern Ireland and Great Britain.
But the government dropped the clauses last week after reaching an "agreement in principle" with the EU over issues including border control posts and the supply of medicines.