The news agency reports that scores of jihadists in trucks stormed the base at Zari village in northern Borno state late Thursday and briefly seized it after a fierce battle, they said.
“They came in large numbers in trucks and carrying heavy weapons and engaged soldiers in a battle that lasted for an hour,” a military officer said.
“We lost at least 30 men,” the officer said, adding that the attack took place at around 4:00 pm.
“They overwhelmed the troops who were forced to temporarily withdraw before reinforcements arrived,” said the officer who asked not to be named because he was not authorised to speak.
Boko Haram has intensified attacks on military targets in recent months despite repeated claims by the military that Jihadists had been defeated.
The militants took weapons and military equipment before they were pushed out of the base by troops with aerial support, said a second military source who gave a similar death toll.
“The terrorists also suffered heavy casualty from the bombardment”, one of the military officers said.
Zari is located 30 kilometres (20 miles) from the town of Damasak on the border with Niger.
The jihadists are thought to have attacked the base from the nearby Garunda village, where 17 troops were killed and 14 injured in an attack on another military base last month, the sources said.
The Boko Haram insurgency which is in its ninth year has left over 20,000 people dead and displaced 2.6 million.
Soldiers and civilians have also been targeted in separate attacks in neighbouring Chad, Niger and Cameroon.