A seven-year-old boy who went to pray with his father in the Narayanganj district was among the dead. The father is in a critical condition.
The series of explosions triggered a fire as worshippers were finishing their prayers on Friday night.
At least 37 people were admitted to a burns unit in a state-run hospital in Dhaka, where 24 subsequently died.
Doctors said the others were critical after suffering burns on up to 90% of their bodies.
Officials said the impact of the blast caused at least six air conditioners to also explode as the fire rapidly spread through the packed mosque.
Authorities said they suspected gas had accumulated inside the mosque from a leak in the underground pipeline. The windows were shut because of the air conditioners.