Thousands of civilians have fled the town, along with soldiers, they added.
However, military sources said the army was still in control of Bama, the second biggest town in Borno state.
Last month, Boko Haram said it had established an Islamic state in the towns and villages it controls in north-eastern Nigeria.
If confirmed, the capture of Bama would be an extremely significant development and would raise concerns that Boko Haram’s next target will be Maiduguri, the state capital about 44 miles away.
Boko Haram captured Bama, which the 2006 census showed had a population of about 270,000, after heavy fighting on August 31 and September 1.
The militants, who travelled in tanks and armored trucks, first seized the military barracks in the town, residents said.
Nigerian security sources said the assault had been repelled and about 70 militants had been killed, news agencies report.
The air force was used to “dislodge the swamp of terrorists” from Bama, the military said on its Twitter account.
An overnight curfew has been imposed in Maiduguri to prevent “infiltration” by militants after the “heavy casualties” they suffered, it added.
Boko Haram’s five-year insurgency has intensified in recent months despite the deployment of thousands of extra troops to the worst-affected areas.
In April 2014, Boko Haram captured more than 200 girls from a boarding school in the town of Chibok, also in Borno state.
kP_dLXUWLhwThe US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…