The mosque is within the tightly-guarded police headquarters area.
Prime Minister Shehbaz Sharif said "terrorists want to create fear by targeting those who perform the duty of defending Pakistan".
No group has said it carried out the attack, but it has been linked to the Pakistan Taliban.
The group ended a ceasefire in November, and violence has been on the rise since.
In December it targeted a police station - like Peshawar, in the north-west of the country - leading to the deaths of 33 militants.