No 10 has reached a deal with some of the Tory MPs unhappy with plans to give the government the power to override parts of the UK's Brexit agreement.
Boris Johnson has agreed to amend the Internal Market Bill, giving MPs a vote before he could use the powers in it that would break international law.
The move could head off a potential rebellion over the issue next week.
But Labour said the UK was on course to break its word, as a senior government legal officer quit over the issue.
Lord Keen, Scotland's Advocate General, stood down on Wednesday after days of speculation about his future.
In his resignation letter, he told the PM: "I have found it increasingly difficult to reconcile what I consider to be my obligations as a Law Officer with your policy intentions."
The peer, who served in the Ministry of Justice, objected to proposed legislation which would allow the government to override parts of the EU withdrawal agreement, in contravention of international law.
But less than a hour after his exit was confirmed, Downing Street said it had reached a compromise with two critics of sections of the bill, ex-justice minister Sir Bob Neill and former work and pensions secretary Damian Green.
A government amendment to the bill, published on Thursday, would prevent ministers from activating powers in the bill to override the Brexit divorce deal until MPs had voted to approve it first.
The provision is similar to the changes to the bill proposed by Sir Bob, who will now drop his planned amendment.
Ministers have also tabled amendments to place a time-limit on attempts to question the legality of controversial sections of the bill via judicial review.
Tonight's compromise - some would say U-turn - between Downing Street and potential Conservative rebels appears to have solved one short-term problem.
It staves off the prospect of a serious, if not fatal, show of high-profile dissent next week when MPs debate the specific clauses of the bill that would breach international law.
The "parliamentary lock" would allow MPs as a whole, and not just ministers, to decide whether to press the political equivalent of the nuclear button.
It is thought MPs may be less likely to do so. But this compromise won't be enough to stop the bill being potentially savaged in the Lords.
Eminent peers with a background in the legal profession maintain that it is still wrong to legislate with the intention of breaking international law.
They will be bolstered by Lord Keen's resignation - as he has made it clear that he couldn't reconcile his responsibilities as a law officer with the government's policy.
And Brussels is insisting that the clauses which override part of the Brexit deal in Northern Ireland should be removed entirely. Otherwise the EU could take the UK government to court.
In a joint statement with No 10, Mr Green - head of a centrist group of Tory MPs - said: "The Internal Market Bill was designed to give MPs and peers a vote on the use of these powers via statutory instrument.
"But following talks, it is agreed that the Parliamentary procedure suggested by some colleagues provides a clearer, more explicit democratic mandate for the use of these powers, and also provides more legal certainty."
The statement claims that on the Tory benches there is "near-unanimous agreement that the government must be able to use these powers as a final resort, that there must be legal certainty, and that no further amendments are required on these powers".
Mr Green urged the government to focus on settling the terms of its future economic partnership with the bloc before the 15 October deadline set by the PM.
Senior Tory backbencher Sir Roger Gale, who had threatened to vote against the bill unless it was changed, welcomed the government's plans to amend it.
In a tweet on Thursday, he wrote: "Good that Bob Neill's amendment, which I endorsed, has effectively been accepted.
"At least Parliament will now have the chance to vote again if the government proposes to change the withdrawal agreement."
The bill has provoked a backlash from the EU, which has threatened legal action - and the possible suspension of trade talks - if the measures overriding the withdrawal agreement are not withdrawn.
And Labour's shadow business secretary Ed Miliband said his party would continue opposing the legislation.
Responding to the joint statement on Wednesday he said: "This does not fix the problem of breaking the law, damaging our reputation around the world and damaging our future prosperity.
"We need a trade deal with Europe and that is what we were promised. Breaking our own word and the treaty the prime minister signed puts that at risk."
Defending the bill on Wednesday during an appearance before a committee of senior MPs, Mr Johnson said he believed the EU may not be negotiating with the UK in good faith over the agreement's implementation.
Pressed by Labour's Hilary Benn on whether he thought the EU was negotiating in good faith, he said: "I don't believe they are."
This contradicted Northern Ireland Secretary Brandon Lewis, who earlier told MPs he believed the EU was acting in good faith.
When that was put to him, Mr Johnson said it was "always possible that I am mistaken and perhaps they will prove my suspicions wrong".
Both sides have a duty to act in good faith under Article 5 of the withdrawal agreement - but it is difficult to demonstrate a lack of "good faith" or "best endeavours" - another phrase enshrined in the treaty.
The legal definition of "good faith" is stronger than the generally accepted meaning of the words.
What is the Internal Market Bill?
The bill sets out rules for the operation of the UK internal market - trade between England, Scotland, Wales and Northern Ireland - after the end of the Brexit transition period in January.
- No new checks on goods moving from Northern Ireland to the rest of Great Britain
- Giving UK ministers powers to modify or "disapply" rules relating to the movement of goods that will come into force from 1 January if the UK and EU are unable to reach an alternative agreement through a trade deal
- Powers to override previously agreed obligations on state aid - government support for businesses.
The bill explicitly states that these powers should apply even if they are incompatible with international law.
Ministers say the legislation is needed to prevent "damaging" tariffs on goods travelling from the rest of the UK to Northern Ireland if negotiations with the EU on a free trade agreement fail.
The legislation has also proved controversial with the devolved administrations, which are concerned about how the UK's "internal market" will operate post-Brexit and who will set regulations and standards.