The UK is to increase its military support to Nigeria to help protect its citizens and British workers in the country from terror attacks.
The Nigerian armed forces will be given specialist equipment and training to counter the use of improvised explosive devices by Islamist insurgents.
On a visit to Abuja, Theresa May said tackling the "menace" from groups like Boko Haram was in the UK's interest.
She has also agreed a £10.5m package to help victims of modern slavery.
As part of this, the UK will provide counselling to up to 1,700 people who have been subjected to forced labour, domestic servitude and sexual abuse and help them re-integrate into their communities.
A joint initiative with France will also see the UK assist Nigeria and Niger strengthen their border cooperation to prevent trafficking of migrants to Libya and Europe.
After talks with President Muhammadu Buhari in the nation's capital Abuja, Mrs May announced the two countries had signed a defence and security partnership which could see the UK train, for the first time, full army units to combat insurgents in the north-east of Nigeria.
The UK, which has trained 30,000 Nigerian troops since 2015, will also help set up an emergency response mechanism, along the lines of the UK's Cobra crisis system, to deal with terror attacks while also stepping up efforts to tackle the propaganda spread by Islamic State-Daesh and other militant groups.
"We are determined to work side by side with Nigeria to help them fight terrorism, reduce conflict and lay the foundations for the future stability and prosperity that will benefit us all," Mrs May said.
The PM also announced further co-operation on piracy, organised crime and human trafficking, including a new taskforce to help Nigeria recover stolen assets held in the UK.
Labour's Shadow Home Secretary Diane Abbott said Mrs May's "warm words" rang hollow as her government had cut Border Force staff and police officers, who were "the frontline in the fight against modern slavery".
Mrs May's three-day trip to Africa, which began in South Africa on Tuesday, is aimed at deepen economic and trade ties with growing African economies ahead of Britain leaving the EU in 2019.
Mrs May said Brexit would increase opportunities to extend existing commercial links with Nigeria - the UK's second largest trading partner in Africa - particularly in the area of financial services.
"We offer, as the United Kingdom the important capacity the bring in the access to capital markets through the City of London together with professional service expertise with great private sector companies," she said.
She has already aannounced £4bn of extra British support for African economies and said she wanted the UK to overtake the US to become the G7's biggest investor in Africa by 2022.
She struck Britain's first post-Brexit trade pact with Mozambique and the Southern African Customs Union, made up of six African nations. The EU currently has an economic partnership with this union, and the UK will now continue working with it after Brexit.
On Thursday, she will finish her tour in Kenya, where she will hold talks with President Uhuru Kenyatta and attend a state dinner, visit a business school and meet British troops.
Asked about the state of Brexit negotiations on Tuesday, Mrs May cited comments by the head of the World Trade Organisation, who said Brexit "won't be a walk in the park, but won't be end of the world either".
"We are working for a good deal, we have put forward our proposal for a good deal," she said. "I believe that deal is to the benefit, not only of the UK, but the EU."
Nigeria: May's trade mission
By BBC Africa business editor Larry Madowo
Nigeria is Britain's second largest trading partner in Africa, but should the country be so focused on the UK?
Tunji Andrews, an economist based in Nigeria's commercial hub Lagos, believes Nigeria should concentrate more on its relationship with the European Union.
"The diversity of demand of the EU market makes it slightly more attractive.
"I think it's impossible not to look at the British market at this point, but I'll also say that while Britain remains a viable trade partner, it just doesn't hold the same value to Africa as China and to a lesser extent, the US."
Nigeria's top export to the UK is crude oil and its largest import is refined oil, a structural inefficiency that leads to regular fuel shortages as the populous West African nation lacks a properly functioning refinery.