The attack, which happened on Wednesday near the town of Damboa, on the edge of Boko Haram’s Sambisa Forest enclave in Borno state, is the second against the military within a week.
Last Friday, one soldier was killed and nine others were wounded as the jihadists overran a military base in the town of Marte, near the shores of Lake Chad.
They then fled with arms and ammunition.
A senior military officer said the attack, which happened early on Wednesday, targeted a convoy travelling between Damboa and state capital Maiduguri.
“We lost three soldiers in the ambush by Boko Haram terrorists.
“The terrorists in large number opened fire on the convoy of the commanding officer of 81 Battalion… Five other troops were injured in the intense battle that broke out when soldiers engaged the attackers.”
The officer, who spoke on condition of anonymity as he was not authorised to talk to the media, said the arrival of reinforcements forced the rebels to retreat.
A commercial bus driver who was caught in the ambush gave a similar account.
“I was one of those trailing behind the military convoy when Boko Haram opened fire and soldiers responded with fire,” said Sani Mato by telephone from Maiduguri.
“The soldiers were able to repel the attack but lost three men. Five were also injured.”
Roads to and from Maiduguri are nominally open to traffic but in reality, vehicles require a military escort because of the risk of attack.
Nigeria’s military and government maintain that Boko Haram is a spent force as a result of sustained counter-insurgency operations against them since early 2015.
Deadly attacks have dropped in recent weeks, which security sources attribute to renewed military offensives after the end of the rainy season in September.
But suicide bombings remain a threat, particularly to civilians at “soft” targets such as mosques, markets and camps for those displaced by the conflict.
On October 12, five people were killed in a suicide attack in the remote village of Belbelu, near Kayamla, in the Konduga area of Borno state.