At least seven other soldiers were injured in the operation early yesterday, said General Jacob Kodji.
The Nigerian Islamic extremist group launched a series of attacks in Cameroon earlier this week, said Kodji. Ashigashiya straddles the border of northern Cameroon and Nigeria.
"At least 27 Boko Haram fighters were killed in Thursday morning's operation," said Kodji, commander of Cameroon troops in the area. The soldiers remain on the battle front there, he said.
Regional forces from Cameroon and Nigeria have since December 2015 been launching raids on Boko Haram strongholds along their borders, especially around Ashigashiya.
The Islamic militants began attacks across borders in 2014 and stepped them up early last year on neighboring Cameroon and other countries that have supported the Nigerian military's effort to crush Boko Haram.
In northern Cameroon, officials said two suicide bombers believed to have come from Nigeria on Wednesday killed 10 people and injured 40 attending a wake in a border village.
Attacks in Chad and Niger also are blamed on Boko Haram.
Boko Haram's 6-year-old Islamic insurgency has killed 20,000 people, and displaced 2.5 million people, according to Amnesty International and the United nations.