Downing Street hopes the assistance will also better protect the UK from terror threats while also saving the lives of soldiers and civilians living in Nigeria.
The terror group has killed more than 20,000 people and forced hundreds of thousands to flee their homes.
Mrs May faced questions about the decision to increase support despite Amnesty International raising allegations about Nigerian soldiers raping women rescued from Boko Haram.
The PM told reporters she raised the issue of human rights with president Buhari, adding she welcomed his decision to establish an inquiry to examine the allegations.
The deal includes training to counter improvised explosive devices, £13million to educate 100,000 children living in areas of conflict, developing the Nigerian government’s procedures to respond to terror attacks, and aiding Nigeria in the propaganda war.
Nigerian army units will also be trained as a whole rather than individually by the UK before their deployment.
Attempts to help Nigeria recover stolen assets held in the UK and to reduce corruption will also be made via a new “civil asset recovery taskforce”, Downing Street added.
Mrs May arrived in Nigeria yesterday on day two of her whistle-stop Africa tour with trade and efforts to combat people trafficking also on the agenda.
Rain started to fall as Mrs May left the RAF Voyager and after a military reception, she resisted the temptation to dance for a second day when greeted by dancers and drummers at the airport in Abuja.
She travelled to the presidential villa for talks with President Buhari, amid a chaotic media scrum on the red carpet.
Mrs May later travelled to Lagos to announce business projects, develop financial links amid post-Brexit uncertainty for the City of London, and meet survivors of modern slavery.
On the security and defence agreement, the PM said: “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 arrived in Nigeria after making her pitch for the UK to help develop Africa, particularly in the post-Brexit world, and seize a greater share in the market amid fierce global competition from China, France and the United States.
Her three-day trade mission ends in Kenya today.
Mrs May has been joined by junior ministers and business leaders.