The attack came less than a day after a suicide bomber blew up in a mosque in Jamrud in the nearby Khyber agency, killing 48 people and wounding scores more.
Pro-Taliban fighters were suspected of carrying out the attack to avenge recent military operations in the area aimed at protecting the Nato supply route, authorities said.
The route passed in front of the mosque, where about 200 worshippers had gathered to pray at the time of the blast.
Relatives and residents buried the bombing's victims on Saturday.
"The whole town is in mourning," said Bakhtiar Mohmand, a local administration official.
Lorries belonging to drivers and helpers who were believed to have been killed after stopping to offer prayers remained parked close to the mosque.
Pakistani authorities are reported to be holding two suspects in connection with the attack.
Tariq Hayat, the most senior administrator of Khyber, said 48 bodies were found in the rubble of the Jamrud mosque and the death toll was likely to rise.
More than 100 people were wounded, medical officials said.
Zeina Khodr, Al Jazeera's correspondent in Islamabad, said many of those killed were members of the security forces.
The mosque is near a police checkpoint and "people in that checkpoint usually pray in this mosque", she said.
Asif Ali Zardari, the Pakistani president, and Yousuf Raza Gilani, the prime minister, both "strongly condemned the suicide attack".
They vowed that the perpetrators would be brought to justice.