The clashes took place in an area between the tribal districts of Kurram and Khyber, in the villages of Para Chamkani and Maidan, during an operation against Taliban militants.
"During the last 24 hours at least 34 militants have been killed in the operation," a senior security official told AFP.
A second security official based in northwestern Peshawar city confirmed the toll.
Earlier in the day, the military said in a statement that 19 militants were killed and 12 others were wounded and three of its soldiers also died in gunfights.
The dominating heights of the mountainous area had also been cleared or occupied by forces, the statement said.
The death toll could not be verified by independent sources as the area is out of bounds for media due to ongoing military operations.
The fighting took place in the wake of a fresh military push in the Tirah valley in Khyber tribal district, where the military has been targeting Taliban and Lashkar-e-Islam militia threatening the nearby city of Peshawar.
Khyber straddles the NATO supply line into Afghanistan, used by US-led troops to evacuate military equipment ahead of their 2014 withdrawal.
Pakistani troops have been fighting for years against homegrown insurgents in the tribal belt, which Washington considers the main hub of Taliban and Al-Qaeda militants plotting attacks on the West and in Afghanistan.