Polls have closed in the by-elections being held in Wakefield and Tiverton and Honiton and the counting of votes is under way.
Both seats were held by the Conservatives before their previous MPs resigned in disgrace, triggering the by-elections.
Results are expected to be announced overnight.
Early signs suggested Labour was in the ascendancy in Wakefield and the Liberal Democrats in Tiverton and Honiton.
Labour ‘confident’ in Wakefield and ‘political earthquake’ on the cards for Lib Dems in Tiverton
Asked whether he would consider his position if he lost both by-elections, the prime minister said: “I’m going to be watching the results with interest.”
While “always full of optimism and buoyancy”, the PM cautioned: “I think most seasoned political observers such as yourself know that by-elections in midterm are never necessarily easy for any government.”
In Wakefield, West Yorkshire, ex-Conservative MP Imran Ahmad Khan stood down after being found guilty of sexually assaulting a 15-year-old boy and being jailed for 18 months.
Once one of the so-called Red Wall seats, it was won by the Tories in the 2019 general election, though Labour is now hoping to take it back.
In Tiverton and Honiton, Devon, Neil Parish resigned after admitting he had watched pornography twice on his phone in the House of Commons.
The Liberal Democrats have their sights set on the constituency and would need to overturn a Conservative majority of 24,239.
If the Conservatives lose both by-elections, it would be only the seventh time a government has suffered a double defeat since the Second World War.
Labour’s national campaign coordinator Shabana Mahmood said voters were returning to the party under Sir Keir Starmer’s leadership.
She said: “Labour has run positive campaigns with fantastic candidates in both by-elections – but we know that taking the seats requires many Tory voters to switch to Labour, which is harder in by-elections where low turnout is commonplace.
“Wakefield has been a marginal constituency since Labour last won a General Election, and the Conservatives hold the seat with the biggest majority since 2010 – making this an uphill task.
“While we await the results in both elections – the message we have heard is clear: many are coming back to Labour under Keir Starmer’s leadership.”
The Liberal Democrats said a significant swing away from the Tories in Tiverton and Honiton, one of the party’s safest seats, could see Mr Johnson’s MPs looking nervously over their shoulder.
Treasury spokesperson Christine Jardine said: “Never in the history of British politics has a majority this big been overturned in a by-election. We’ve said throughout this campaign this is a huge mountain to climb.
“However, if the Conservative Party lose significant numbers of votes tonight in one of their safest seats in the country, there will be countless Conservative MPs looking over their shoulders nervously tomorrow.”
Tory MPs on the ground pointed to a likely “mid-term” backlash against a party that has been in place for 12 years as well as the fall-out from the PM’s bruising confidence vote.
Luke Hall, who was at the Tiverton and Honiton count, said: “What I would accept is that this has been a challenging campaign in the circumstances.”