No casualties were reported but the raid highlighted fragile security in Nigeria's northeast, where the army is still battling to end a conflict that erupted in 2009.
Militants arrived in trucks in Jimmi, 5 km (3 miles) from Maiduguri city, and opened fire, setting homes ablaze and also attacking an informal refugee camp, Presstv reported.
"Boko Haram terrorists this evening attacked Jimmi village," militia leader in Maiduguri Musa Ari said. “They burnt homes in Jimmi and tents in the camp."
Military authorities scrambled reinforcements and fighter jets to repel the attack, said militia leader Ibrahim Liman.
Panicked villagers from the area fled to nearby Maiduguri, capital of Borno state which along with neighboring Yobe state has been at the center of the militant insurgency.
"We left our village to escape Boko Haram who attacked our neighbors in Jimmi," said Bale-Shuwa village resident Suleiman Balarabe.
He said villagers saw military jets flying overhead towards Jimmi.
"The sounds of guns coming from Jimmi terrified us and made us leave our homes because we were afraid they were going to attack our neighborhood," said Sanda Gini, a resident of Jiddari-Polo area on the outskirts of Maiduguri.
In April, scores of Boko Haram fighters launched a gun attack on Jiddari-Polo when they advanced on Giwa barracks where hundreds of their militant comrades are being detained.
Insurgents fired automatic weapons and rocket-propelled grenades at troops before they were repelled with aerial support.
Despite government insistence Boko Haram militants are near defeat, in recent months the militant group has carried out major attacks on military targets, killing dozens.
Boko Haram's nine-year conflict has killed an estimated 27,000 people and displaced two million, creating a humanitarian crisis and spilling into Nigeria's northern neighbors.