Unlike presidents in many republics, the UK Prime Minister has no fixed term of office. They serve "at His Majesty's pleasure"—meaning they remain in power until one of four things happens:
The PM must maintain the confidence of the House of Commons. Since the Fixed-term Parliaments Act 2011 was repealed in 2022, the PM can request a dissolution and general election at any time (within the 5-year maximum parliamentary term). If they lose that election, they resign.
In practice, a PM's tenure depends on retaining their party's leadership. Most recent PMs (Thatcher, Major, Blair, Brown, Cameron, May, Johnson, Truss, Sunak) left office due to party pressure or election defeat rather than formal constitutional mechanisms.
The absence of term limits means a PM could theoretically serve for decades—if they keep winning elections and retaining party support.