“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, after it was named by a small number of girls who escaped.
Mr Buhari said in his statement that efforts to find the remaining girls would be intensified.
He went on to congratulate the armed forces on the Sambisa 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.
The army has recaptured significant areas of territory previously controlled by Boko Haram since an offensive began in February.
The militant group still stages suicide bombings in the northeast of Nigeria and in neighbouring Niger and Cameroon.
Its fighters are 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.