Islamist extremists tried to enter Maiduguri, the capital of Borno state, during a predawn attack after the army fought them off last week.
Gunfire raged for hours outside the city, residents said.
"Fighting has been going on since 3 a.m. as Boko Haram battles soldiers and vigilantes," said Mahmud Kyari, who lives in Maiduguri. "Explosions and gunfire are all we hear."
The militants launched bomb and gun attacks from three points outside the city, but met stiff resistance from troops and vigilantes, residents said.
Government officials said fighter jets were pounding the insurgents.
gunmen have been routed and are on the run," said Sadiq Balarabe, another resident.
Previous attempt last week
Soldiers repelled attacks in Maiduguri on January 25, but the extremists seized the nearby town of Monguno and its military barracks.
Monguno is 135 kilometers (85 miles) from Maiduguri.
Both cities are near the Chad and Cameroon borders, which would give the militants an entry point into those countries.
Monguno and its military post had served as a buffer to keep the militants away from Maiduguri. Its fall left Maiduguri vulnerable to capture by the militants.
Crackdown on militants will continue
Borno Gov. Kashim Shettima said young people from the state joined the military and vigilantes in the fight to repel Boko Haram.
The youths "sacrificed their lives and moved to frontlines to support our gallant armed forces in a patriotic battle to defend the soul of Borno state and its people from being seized by determined insurgents," he said in a statement.
"I am confident that as a people, we can overcome the threat of insurgents," Shettima said. "Borno is our land, we cannot and we must not allow anyone push us out of our land."
The governor said he is not asking citizens to take justice into their own hands, but to register and get training to support the military.
Elections two weeks away
The latest attacks come as Nigeria prepares for elections February 14. U.S. Secretary of State John Kerry was in the nation last month to call for peaceful voting.
In neighboring Yobe state, a suicide blast Sunday outside the home of a prominent politician killed seven people and injured several others, a police officer and witnesses said.
Sabo Garbu, a candidate of Nigeria's ruling Peoples Democratic Party, was not injured in the explosion. It occurred while he was holding a meeting with his campaign team at his home in Potiskum town.
"We were outside the house when a bus pulled over and an unkempt man was pushed out," said Tijjani Mamman, who was among a crowd of supporters outside the home at the time of the blast. "The bus drove off and before anybody realized what was happening , the man exploded."
Though one has claimed responsibility for Sunday's blast, Boko Haram has carried out a spate of suicide attacks in Potiskum in recent weeks.
Boko Haram has terrorized northern Nigeria regularly since 2009, attacking police, schools, churches and civilians, as well as bombing government buildings.
The Islamist group has said its aim is to impose a stricter form of Sharia law across Nigeria, which is split between a majority Muslim north and a mostly Christian south.