The military used helicopters gunships and artillery during the fighting, which erupted when militants attacked security positions in the North Waziristan region on March 4.
A military spokesman said 25 militants were killed in Miranshah and 21 in Mir Ali, but added that the death toll could be higher.
The violence erupted as U.S. President George W. Bush was visiting Islamabad for talks with Pakistani President Pervez Musharraf on cooperation in the war on terrorism. Bush has since returned to Washington.
The Pakistani army on March 1 said around 45 mostly foreign fighters were killed in an attack on a militant hideout in the same area.
(compiled from agency reports)