Theresa May has promised to set a timetable for the election of her successor after the next Brexit vote in the first week of June.
The agreement follows a meeting between the prime minister and senior Tory MPs who are demanding a date for her departure from Downing Street.
If she loses the vote on her Brexit plan, already rejected three times, sources told the BBC she would resign.
Meanwhile, Boris Johnson has said he will run for leader once Mrs May goes.
The prime minister survived a confidence vote by Conservative MPs at the end of last year and party rules mean she cannot formally be challenged again until December.
But Mrs May has come under increasing pressure to leave Downing Street this summer, amid the Brexit impasse and poor results for the Conservatives in the recent local elections in England.
BBC political editor Laura Kuenssberg said senior sources had told her it was "inconceivable" the prime minister could remain in office if MPs rejected her Brexit plans for the fourth time.
The chairman of the 1922 committee of Conservative MPs, Sir Graham Brady, said he had reached an agreement over the prime minister's future during "very frank" talks in Parliament.
He said the committee's executive and Mrs May would meet again to discuss her future following the first debate and vote on the Withdrawal Agreement Bill in the week beginning 3 June.
Sir Graham said there was now "greater clarity" about the situation.
Asked if that meant the prime minister would quit immediately if MPs rejected her Brexit plans once more, he said that scenario went "beyond" what had been agreed.
MPs have rejected the prime minister's Brexit agreement with the EU three times.
But she will have another go at gaining their support in the week beginning 3 June, when the Commons votes for the first time on the EU Withdrawal Agreement Bill - legislation needed to implement her deal with the EU.
Former foreign secretary Boris Johnson has joined the growing list of Conservatives who say they will stand for leader when Mrs May announces her departure.
He told a business conference in Manchester: "Of course I am going to go for it."
Conservative MP Grant Shapps welcomed the announcement that a timetable would be set out for Mrs May's departure, suggesting it would inject greater ambition and dynamism into the Brexit process.
The former party chairman told BBC News the Brexit bill had no chance of passing in its current state but holding another vote would allow Mrs May to demonstrate she had "tried everything".
"It is right to bring this whole saga to a conclusion," he said.
But fellow Tory Phillip Lee, who backs another Brexit referendum, said replacing the prime minister would not "solve the crisis" the UK found itself in or build a parliamentary majority for the terms of the UK's departure.
"Forcing the PM's resignation and spending this summer locked in a leadership election where candidates trade ever more fantastic visions of unicorn Brexits…is neither in the interests of the Conservative Party nor of the United Kingdom," he said.
Last month, the 1922 Committee executive narrowly decided against changing the party's leadership rules to allow an early challenge to Mrs May.
Local Tory associations have confirmed they will hold a vote of confidence in her leadership on 15 June, although its result will not be binding.
Much of the anger in the Conservative parliamentary party is focusing on the prime minister's talks with Labour, aimed at reaching a cross-party compromise to get her deal through the Commons.
BBC Newsnight political editor Nick Watt said he understood the talks will "soon be drawing to a close" adding that Tory whips had "given up on this phase of the negotiations and are looking to pack the legislation with goodies for Brexiteers".
Labour leader Jeremy Corbyn said his party would not support the Withdrawal Agreement Bill unless it guaranteed membership of a customs union with the EU, and protected workers' rights, consumer rights and environmental rights.
Meanwhile, Liberal Democrat leader Sir Vince Cable said his party would "happily support" the legislation, provided it was subject to a "confirmatory public vote".