Brexit vote: Government defeats EU customs union bidThe government has survived an attempt by pro-EU Conservative MPs to change its post-Brexit trade strategy.
The MPs wanted the UK to join a customs union if it does not agree a free-trade deal with the EU.
But the government, which says a customs union would stop it striking new trade deals, won by 307 to 301.
Ahead of the vote, Tory MPs were told a defeat would lead to a vote of no confidence in the government, sources told the BBC's John Pienaar.
The government did, however, lose a separate vote on its Trade Bill on the regulation of medicines after Brexit.
MPs backed an amendment by 305 votes to 301 that would keep the UK in the European medicines regulatory network.
There were 12 Tory rebels in both the customs and medicines votes - but the government's total was boosted by four Labour MPs in the customs vote.
The vote on medicine regulation was only the government's second defeat on Brexit in the House of Commons.
MPs voted for the UK to take "all necessary steps" to participate in the regulatory network operated by the European Medicines Agency after it leaves the EU.
The agency, which evaluates and supervises medicines and helps national authorities authorise the sale of drugs across the EU, is currently based in London but is moving to Amsterdam after Brexit.
There have been warnings that Brexit may cause delays in UK patients getting new drugs.
The government says it is "seeking participation" in the agency after Brexit and would make an "appropriate financial contribution" in return.
But it has not agreed to take "all necessary steps" to secure this.
Responding to the defeat, the government said: "We will now reflect on this amendment and seek to revisit in the Lords."