According to Russian news agency TASS, the blast occurred in the city of Qala-e-Naw, the capital of Badghis province, which borders the Central Asian country of Turkmenistan.
Baz Mohammad Sarwari of Badghis province said the cause of the explosion is unknown but investigations are ongoing.
No one immediately claimed responsibility for the explosion. A local outfit affiliated with the militant Islamic State group has in the past repeatedly claimed responsibility for similar attacks.
Sarwari said the wounded were transferred to the provincial hospital while Taliban troops secured the area.
The explosion went off while dozens of worshippers had gathered inside the mosque for Friday prayers.
Last month, a bomb blast on a minibus had killed at least seven people in the western Afghan city of Herat. The sticky bomb was attached to the fuel tank of the bus and left nine other people wounded.