The assault in the early hours of Friday took place in the town of Dangdala, near the banks of Lake Chad, two security sources told the Reuters news agency.
The attackers were believed to have crossed the border from neighbouring Niger before launching the attack.
“Boko Haram elements attacked the Chadian army position at around 1am (00:00 GMT), killing 23 troops,” a military official told AFP news agency.
Boko Haram has been fighting for a decade to carve an Islamic caliphate out of northeast Nigeria, and has carried out regular raids over loosely guarded frontiers into neighbouring Chad, Niger and Cameroon.
The violence over the past decade has killed an estimated 30,000 people and forced about two million to leave their homes.
Chadian soldiers are part of the G5 Sahel Force, a US-trained West African task force deployed to counter Boko Haram.
In southeastern Niger, meanwhile, eight civilians were killed late on Thursday in a Boko Haram attack in Karidi, in the Gueskerou district, a local official told the AFP news agency on Friday.
Gueskerou lies in the Diffa region, which borders Lake Chad, and is one of the worst-hit areas for attacks in Niger.
A total of 16 troops were killed in attacks on February 16 and March 9, while Niger’s armed forces said it had killed 33 “terrorists” on March 12.