The PM said legislation was needed to resolve "tensions" in the EU-UK deal.
He said it would ensure the UK could not be "broken up" by a foreign power and the EU was acting in an "extreme way", by threatening food exports.
Labour said the PM had caused the "mess" by reneging on a deal he had previously called a "triumph".
The Internal Market Bill is expected to pass its first parliamentary test shortly, when MPs vote on it at about 22.00 BST, despite the reservations of many MPs that it gives the UK the power to break international law.
A number of Conservative MPs have said they will not support the bill as it stands and some could register their concerns by abstaining.
The UK left the EU on 31 January, having negotiated and signed the withdrawal agreement with the bloc.
A key part of the agreement - which is now an international treaty - was the Northern Ireland Protocol, designed to prevent a hard border returning to the island of Ireland.
The Internal Market Bill proposed by the government would override that part of that agreement when it comes to movement of goods between Northern Ireland and Britain and would allow the UK to re-interpret "state aid" rules on subsidies for firms in Northern Ireland, in the event of the two sides not agreeing a future trade deal.
Speaking at the start of the five-hour debate, the PM said the bill should be "welcomed by everyone" who cares about the "sovereignty and integrity of the UK".
He said the UK had signed up to the "finely balanced" withdrawal agreement, including the Northern Ireland Protocol, in "good faith" and was committed to honouring its obligations, including the introduction of "light touch" checks on trade between Britain and Northern Ireland.
But he said additional "protective powers" were now necessary to guard against the EU's "proven willingness" to interpret aspects of the agreement in "absurd" ways, "simply to exert leverage" in the trade talks.
"What we cannot tolerate now is a situation where our EU counterparts seriously believe they have the power to break up our country," he told MPs.
"We cannot have a situation where the very boundaries of our country can be dictated to by a foreign power or international organisation."
He also suggested the EU was threatening not to allow British firms to export products of animal origin to either the continent or Northern Ireland.
"Absurd and self-defeating as that action would be...the EU still have not taken this revolver off the table," he told MPs.
However, he sought to reassure MPs that the powers were an "insurance policy" and Parliament would be given a vote before they were ever invoked, insisting "I have absolutely no desire to use these measures".
But former Labour leader Ed Miliband, standing in for Sir Keir Starmer after the Labour leader was forced to self-isolate at home, said the "very act of passing the law" would constitute a breach of international law.
He told MPs the PM "could not blame anyone else", having drawn up and signed the Brexit deal himself.
"It is his deal, it is his mess, it is his failure," he said. "For the first time in his life, it is time to take responsibility and to fess up," he said. "Either he was not straight with the country in the first place or he did not understand it."
He added: "This is not just legislative hooliganism on any issue, it is on the most sensitive issue of all."
Among Tory MPs to speak out were ex-ministers Andrew Mitchell, Sir Bob Neill and Stephen Hammond, all of whom urged the government to settle differences with the EU through the arbitration process in the Agreement.
Conservative MP Charles Walker said the EU was a "pain in the neck" but urged the government not to "press the nuclear button" before all other options had been exhausted.
"I am not going to be voting for this bill at second reading because if you keep whacking a dog, don't be surprised when it bites you back," he said.
And Former Chancellor Sajid Javid has joined the ranks of potential rebels, saying he could not see why it was necessary to "pre-emptively renege" on the withdrawal agreement.
"Breaking international law is never a step that should be taken lightly," he tweeted.
A senior government source told the BBC "all options are on the table" in terms of possible action against Tory MPs who do not support the bill.
The bill, which sets out how trade between different nations of the UK will operate after the UK leaves the EU single market on 31 December, is likely to face more difficulties in its later stages, especially in the House of Lords.
The DUP's Sammy Wilson welcomed the bill, but said his party still had concerns and would be tabling amendments to "ensure Northern Ireland is not left in a state aid straight jacket and our businesses are not weighed down by unnecessary paperwork when trading within the United Kingdom".
The SNP's Ian Blackford said the bill was the "greatest threat" to devolved government in Scotland since the establishment of the Scottish Parliament 20 years ago.
"We are discussing the details of a bill which this government casually and brazenly admits breaks international and domestic law, he said.
Five former prime ministers have raised concerns about the bill, including Boris Johnson's predecessor Theresa May - who is absent from Monday's debate as she is on a visit to South Korea.
Speaking earlier on Monday, David Cameron said "passing an act of Parliament and then going on to break an international treaty obligation...should be the absolute final resort".