The sackings were expected as the president has repeatedly criticised the military’s inability to defeat Islamist group Boko Haram.
The Islamists have recently launched a series of deadly guerrilla attacks, killing more than 250 people.
Boko Haram is thought to be responsible for more than 10,000 deaths since 2009.
The new military chiefs will be expected to work closely with neighbours Chad, Cameroon and Niger as they join forces to tackle Boko Haram.
The group has also stepped up attacks on these countries.
At least 12 civilians were killed in Cameroon in a suspected Boko Haram suicide attack on Sunday evening, a military source told the BBC.
Two soldiers also died, along with two bombers who blew themselves up in Fotokol, near the border with Nigeria.
Chad will be the headquarters of an expanded Nigeria-led regional force of around 7,500 troops.
Its formation has gained momentum since President Buhari took office in May.
On Saturday morning, 15 people died in the main market in Chad’s capital, N’Djamena, when a man dressed in a burka blew himself up.
Boko Haram claimed responsibility for the attack.
The BBC’s Nigeria correspondent, Will Ross, says just hours before his sacking, army chief Lt Gen Kenneth Minima said the upsurge in violence was the result of military success against the jihadists.
Lt Gen Minima suggested Boko Haram no longer had the capacity to fight the army and so had resorted to attacking soft targets with bomb blasts.
Boko Haram at a glance
• Founded in 2002, initially focused on opposing Western-style education – Boko Haram means “Western education is forbidden” in the Hausa language
• Launched military operations in 2009
• Thousands killed, mostly in north-eastern Nigeria, abducted hundreds, including at least 200 schoolgirls
• Joined Islamic State – now calls itself “West African Province”
• Seized large area in north-east, where it declared caliphate in 2014
• Regional force retaken most territory