The favourite to replace Theresa May dodged the question from rival Jeremy Hunt as they went head-to-head in a live TV debate.
Mr Hunt asked Mr Johnson whether, if he became prime minister, he would quit if Britain failed to leave the EU by the deadline of 31 October.
Mr Johnson eventually replied: “I think it is very, very important not to envisage any circumstances in which we would fail to come out of the EU on 31 October.
“I don't want to hold out to the EU the prospect that they might encourage my resignation by refusing to agree a deal.”
However Mr Hunt said his rival had previously said the UK would leave on 31 October “do or die”.
He said: “I think it’s do or die for the country, but not a prime minister who‘ll put his neck on the line and that is not leadership.”
The pair appeared in front of a studio audience during their first live debate of the contest, broadcast on ITV.
The next prime minister will be chosen by Tory members, with the result announced on 23 July.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies