A clash in the town of Bama sparked by an attack on a police base "led to the death of one policeman and 17 Boko Haram terrorists," a military statement said.
Fighting in the town of Malam Fatori after an attack on troops "led to the death of two soldiers and 15 Boko Haram terrorists," it said. Both incidents occurred on Sunday.
According to the military, the insurgents were armed with "sophisticated weapons" and explosives during the attacks.
Both Bama and Malam Fatori are located in Nigeria's Borno state, Boko Haram's home base.
Borno, badly hit by insurgent attacks as well as heavy-handed military raids, is one of three states currently under a state of emergency while security forces pursue an offensive aimed at ending Boko Haram's four-year insurgency.
NJF/NJF