A military source in Maiduguri and a civilian vigilante, Babakura Kolo, both told AFP on Thursday that the fighting lasted for about two hours and that three soldiers were killed.
But Kolo said on Friday that the toll was had risen and that it was “now seven, including one lieutenant, and six rank and file.
The security source said three militants were also killed and troops were combing the area to find other rebel fighters.
AFP contacted the military for comment but there was no immediate response.
Fighters loyal to Abu Musab Al-Barnawi were suspected of carrying out the attack, said Kolo.
The Islamic State group, to which Boko Haram is affiliated, announced that Barnawi was leader last year.
He split from the faction following long-time Boko Haram leader Abubakar Shekau in opposition at his indiscriminate attacks on civilians.
Barnawi has instead vowed to hit only “hard” targets such as the military and police. His group is believed to operate in northern Borno state, towards Lake Chad and the border with Niger.
According to the security source, the insurgents went door to door collecting recently distributed food aid for residents.
Kolo said vigilantes had been told by arrested Boko Haram suspects that they sourced most of their food from Gajiram and Monguno, a garrison town 60 kilometres away.
Nigeria’s government wants the hundreds of thousands of displaced people staying in camps and host communities to return to their homes as soon as the military makes areas safe again.
But another attack on Wednesday near Gajiganna, some 50 kilometres from Maiduguri on the way to Gajiram, highlighted the risks they run.
“Some displaced people were returning to their villages in the area to harvest their abandoned cornfields when they were intercepted by Boko Haram,” said Kolo.
“They killed some and took away others,” he said, without specifying a death toll.