The UK is to send 440 more troops to serve in non-combat roles in Afghanistan, the prime minister will announce at the Brussels Nato summit.
The commitment to Nato's mission in Afghanistan will take the total number of UK troops in the country to 1,090.
Around half of the troops will deploy from the Welsh Guards in August and the remainder will follow by February 2019.
They will help "bring the stability and security that the Afghan people deserve," Theresa May said.
At the height of the war, Nato had more than 130,000 troops from 50 nations in Afghanistan. The UK had 9,500 personnel and 137 bases in Helmand province alone.
As of last month, the number of Nato personnel stood at 16,000 from 39 countries, operating mainly from Kabul and focusing on training and assisting the army and police.
Defence Secretary Gavin Williamson - who wrote to Mrs May recommending more troops - said "whenever the call comes, the UK is always one of the first to step up and support our friends and allies across the globe".
Nato asked Britain to deploy more troops a year ago. In September of last year, the US committed an extra 3,000 troops to support Afghan forces.
Ahead of the summit, which begins on Wednesday, US president Donald Trump, hit out at his Nato allies for failing to spend enough on defence.
"The US is spending many times more than any other country in order to protect them," Mr Trump tweeted.
Analysis by defence correspondent Jonathan Beale
Sending another 440 British troops will make the UK the third biggest contributor to the Nato train, advise, and assist mission in Afghanistan.
The extra troops will arrive later this summer and will reinforce the UK-led Kabul Security Force. It is not a return to a combat role.
Its primary role is to transport international advisers safely around the capital - what British soldiers have dubbed "Armoured Uber".
The US leader's main objection is that a number of member states have not increased their defence budgets to the target of 2% of economic output.
But Mrs May said she expects "to agree an ambitious package of measures to strengthen our deterrence and defence" at the summit.
"And we will continue to make the case for all allies to follow the UK's example and meet the 2% pledge," she added.
The last UK troops in combat roles left Afghanistan in 2014 after being involved in the conflict since 2001.
The additional troops will add to Britain's existing contribution to the UK-led Kabul Security Force and mentor the Afghan National Defence and Security Forces in the country's capital.
"Lasting peace and stability in Afghanistan will help keep the streets of Britain safe and this uplift signals our unwavering commitment to realising that future," Mr Williamson said.