The attackers then burned down the entire village of Njaba, the sources said.
Dozens of gunmen invaded the remote northeastern village before dawn Tuesday, singling out boys and girls between the ages of 13 and 19 and killing them alongside their parents, witnesses said.
Njaba village lies about 65 kilometers (40 miles) south of Maiduguri, the capital of Borno state.
Karimu Lawani, who escaped to Maiduguri after hiding with eight other people behind the barn of a neighbor, said the attackers came into the village at around 5 a.m.
"They shot dead anyone that tried to flee but spared children younger than 13 years old," Lawani said.
He and other survivors counted the victims of the massacre before leaving the village some hours later.
His account was supported by Faltama Bisika, 62, who lost four grandchildren in the attack.
"They hurled petrol bombs into homes and opened fire on anyone trying to flee. They particularly targeted teenagers and elderly people," Bisika said.
News of the attack was slow to emerge due to lack of communication following destruction of cell phone towers in the region in previous Boko Haram attacks.
"I only got information of the attack on my village last night," said a civilian vigilante from Njaba who asked not to be named. The vigilante said his father was among those killed.
The vigilante said he left Njaba for Maiduguri in June to join others fighting against the Islamist radical group.
He said he believes the attackers came from Gwoza -- a town on Nigeria's mountainous border with Cameroon that Boko Haram seized last June -- because Njaba "lies on the route to Gwoza from Maiduguri."