MPs have backed a bid to stop a new prime minister suspending Parliament to force through a no-deal Brexit.
A majority of 41 approved an amendment that blocks suspension between 9 October and 18 December unless a Northern Ireland executive is formed.
Four cabinet ministers, including Philip Hammond, abstained and 17 Tory MPs rebelled, including minister Margot James, who has resigned.
Leadership contender Boris Johnson has not ruled out suspending Parliament.
His rival Jeremy Hunt has ruled out this move.
Ms James told the BBC attempting to suspend Parliament was “too extreme” adding: “I thought the time was right today to join people who are trying to do something about it.”
The four cabinet ministers who abstained are International Development Secretary Rory Stewart, Business Secretary Greg Clark and Justice Secretary David Gauke, as well as Chancellor Mr Hammond.
Mr Clark defended his decision to abstain arguing: “I couldn’t support the idea that we would allow the doors of Parliament to be locked against MPs at this crucially important time – that would be a constitutional outrage.”
Mr Hammond tweeted: “It should not be controversial to believe that Parliament be allowed to sit, and have a say, during a key period in our country’s history.”
A Downing Street spokesman said the prime minister was “obviously disappointed that a number of ministers failed to vote in this afternoon’s division”.
“No doubt her successor will take this into account when forming their government,” the spokesman said.
Labour leader Jeremy Corbyn said the vote was “an important victory to prevent the Tories from suspending Parliament to force through a disastrous no deal”.
BBC political editor Laura Kuenssberg said the Commons had now made it harder for a new prime minister to suspend Parliament.
If the 31 October deadline is reached without Parliament backing an agreement between the UK government and the EU, the UK is scheduled to leave the EU without a deal.
MPs have consistently voted against a no-deal Brexit, but the prime minister could try to get around that by suspending Parliament – proroguing – in the run-up to the deadline, denying them an opportunity to block it.
The amendment to the Northern Ireland (Executive Formation) Bill was put forward by MPs including former minister Alistair Burt and Brexit committee chairman and Labour MP Hilary Benn.
It would mean that if Parliament is prorogued when the government publishes reports on the situation in Northern Ireland, MPs must be recalled to debate them.
Mr Burt told the BBC that Parliament had said “very clearly please don’t bypass us… Parliament must be sitting in the run up to 31 October”.
Mr Benn said: “This is a very significant amendment because it sends a very significant message to the prime minister – if you think you can lock the doors on that chamber and tell us to go away until the 31st October, Parliament will not allow that to happen.”
Conservative MP Anne-Marie Trevelyan attacked those of her colleagues who voted against the government, describing the amendments as “cynical and corrosive”.
However, she added: “They don’t change the underlying legal realities one jot: we are leaving on 31 October with or without a deal.”
In a taste of what and whom the still hypothetical Boris Johnson premiership is likely to face, the new rebel alliance in Parliament has shown its strength – winning a vote that would make it harder for the next PM to shut down Parliament to get round its likely opposition to leaving the EU without a deal.
And in political terms, it’s an all-star cast list, populated with former Remainer ministers – the new “Gaukeward” squad, so-called after the until-recently achingly loyal Justice Secretary, David Gauke.
They are a currently powerful significant slice of the Conservative Party that, with years of ministerial experience between them, is willing to join forces with opposition MPs to make life harder for their next leader.
Those ministers are highly likely to be shoved out of government next week in any case – or, as I understand it, are already planning to congratulate Mr Johnson in one breath next Tuesday, then make it clear with the next that they’d never serve under him, denying the Brexiteers the pleasure of actually witnessing them being sacked.
But today’s vote suggests they have no plans to go quietly. They might be losing their comfy ministerial cars and giving up the red boxes, but they will still have votes.
Leadership contender Mr Hunt admitted that, due to a misunderstanding, he missed the votes. However he said he was opposed to the way MPs had voted arguing Parliament “should not restrict the hands of an incoming government in this way”.
When asked about suspending Parliament during his leadership campaign, Mr Johnson said he would “not take anything off the table”.
He said he wanted to leave the EU on 31 October “come what may”.
MPs also rejected a government attempt to disagree with an amendment put forward by a group of peers, which also bids to stop Parliament being suspended to force through a no-deal Brexit, by 315 votes to 273, a majority of 42.
The bill will now return to the Lords for further consideration.
Former Tory prime minister John Major has said he will seek a judicial review if the next prime minister tries to suspend Parliament.
Campaigner Gina Miller has threatened the same action.