Brexit: Government scrapes through Customs Bill votes
The government has narrowly avoided a defeat on its Customs Bill after agreeing to Brexiteers' demands to change its wording.
It twice survived by just three votes after a backlash from pro-EU Tories who accused Theresa May of "caving in" to the party's Eurosceptic MPs.
Defence Minister Guto Bebb resigned so he could vote against the government.
MPs will carry on debating Brexit on Tuesday when the Trade Bill comes to the Commons.
It gives the government the power to build new trade relationships around the world after the UK leaves the EU, and MPs who support staying in the EU's customs union are seeking to change its wording.
- MP Guto Bebb quits as minister after Brexit vote
- MPs to vote on early summer recess
- Brexit: All you need to know
Critics said the amendments to the Customs Bill laid down by Eurosceptics on Monday would undermine the UK's recently-announced negotiating position.
But Downing Street, which agreed earlier to accept the four amendments, said they were "consistent" with the White Paper where it sets out how it wants to trade with the EU in years to come.
The UK is due to leave the EU on 29 March 2019 but has yet to agree how its final relationship with the bloc will work.
The government, which does not have a Commons majority, has been under pressure from MPs on both sides of the Brexit debate.
This was underlined on Monday as it first accepted a series of demands from Brexiteers who are unhappy at the proposals in the White Paper, believing it keeps the UK too closely tied to the EU.
But this angered MPs from the party's pro-EU wing who refused to back the new amendments, leading to heated exchanges in the House of Commons as the Customs Bill was debated.
Tory MP and Remainer Heidi Allen said she wished the prime minister had "faced down the amendments."
She told BBC Radio 4's Today programme: "What was agreed at Chequers wasn't perfect to us, wasn't perfect to Leavers either, but I think the prime minister had worked exceptionally hard to find a decent first pitch to put to the EU and move forward from that.
"We were all set [on the Remain side] to drop all our amendments and back it, then suddenly we had these rather extreme last minute manoeuvres, which seem to us to deviate the prime minister from her plan and we weren't prepared to do that."
Ms Allen said it was now up to Mrs May to "pick the side of the economy".
Pro-EU MP Anna Soubry suggested backbench Eurosceptic Jacob Rees-Mogg was now "running Britain".
Another Remainer, former Attorney General Dominic Grieve, said the prime minister had, by accepting the amendments, put herself in "a position of considerable weakness".
What the MPs voted on
Mr Rees-Mogg said the amendments were "broadly in line" with government policy, which is why the government accepted them.
By 305 votes to 302 - with 14 Tories rebelling - MPs backed an amendment that prevents the UK from collecting taxes on behalf of the EU, unless the rest of the EU does the same for the UK.
Applying EU tariffs to products destined for the EU is part of Mrs May's plan to avoid friction at UK borders after Brexit.
Another amendment, to ensure the UK is out of the EU's VAT regime, was backed by 303 to 300, with a Tory rebellion of 11.
Three Labour MPs voted with the government.
The government won several other votes more comfortably, and the entire bill was then approved by the House of Commons by 318 to 285.
Little room for manoeuvre
BBC political editor Laura Kuenssberg
It looks a mess because it is a mess. It's getting harder and harder for the prime minister to get things through Parliament - and while calls for a second referendum are widely rejected, that sentiment could change if this kind of gridlock continues.
The PM has spent the last two years trying to compromise. She has a divided party and no majority. There are no easy choices.
But the divisions in the Tory party are daily reducing her room for manoeuvre. In a debate about principle, the problem for some is that compromise is a dirty word.
The three Labour MPs who rebelled against their party whip by voting with the government were Frank Field, Kate Hoey and Graham Stringer - all of whom are pro-Brexit.
Former Labour MP Kelvin Hopkins who now sits as an independent also supported the government on one of the amendments.
The Conservative rebels were the long-time pro-EU MP Ken Clarke, Heidi Allen, Guto Bebb, Richard Benyon, Jonathan Djanogly, Dominic Grieve, Stephen Hammond, Philip Lee, Nicky Morgan, Robert Neill, Mark Pawsey, Antoinette Sandbach, Anna Soubry and Sarah Wollaston.
How has the EU reacted?
BBC Europe editor, Katya Adler said the one priority the EU has is making sure it gets a deal, rather than a "cliff edge" Brexit.
She told Today: "They are following all the ins and outs, and all the turbulence, in UK politics extremely carefully.
"[But] they are wondering if the prime minister - or anyone who could or might take over from her - would even have the political strength to get a deal agreed here in Brussels, then passed by parliament back home."
Adler said the "normally outspoken EU leaders" are keeping quiet as they don't want to "put their oar in right now and risk blowing the whole thing up".
The new Brexit Secretary Dominic Raab is due in Brussels on Thursday to continue negotiations and the EU wants to engage, she added.
"All my EU sources say they want to engage constructively with the whitepaper and avoid giving the impression that it is dead on arrival.
"But importantly, as everyone knows, time for negotiation is running short. They want to complete the withdrawal agreement."