“The terrorists are on the run and no longer have a place to hide,” Mr Buhari said in a statement.
The Islamists’ camp fell at 13:35 local time (12:35 GMT) on Friday, he added.
The army has been engaged for the last few weeks in a major offensive in the forest, a huge former colonial game reserve in north-eastern Borno state.
There has been speculation that some of the Chibok schoolgirls kidnapped in 2014 were being held in the forest.
Some of the abducted girls who escaped shortly after they were seized said they had been kept there.
The army has recaptured significant areas of territory previously controlled by Boko Haram since an offensive began in February.
Mr Buhari issued a statement congratulating the armed forces on the operation, calling the apparent success “long-awaited and most gratifying”.
“I want to use this opportunity to commend the determination, courage and resilience of troops of Operation Lafiya Dole at finally entering and crushing the remnants of the Boko Haram insurgents,” he said.
Boko Haram still stages suicide bombings in the northeast of Nigeria and in neighbouring Niger and Cameroon.
The group is thought to have killed more than 15,000 people and displaced more than two million during a seven-year insurgency in the region.
Leader Abubakar Shekau, who has pledged allegiance to the so-called Islamic State, promotes a version of Islam that forbids Muslims from taking part in any political or social activity associated with Western society.