Baquba is the capital of Diyala province, where recent US and Iraqi offensives targeted fighters from al-Qaeda in Iraq.
Police named one of the dead police officers as Brigadier-General Ali Dulayyan. Two other police brigadier-generals were also killed.
Salah al-Jurani, a police major who was in the mosque, said the bomber appeared to target Raad Mullah Jawad, the provincial governor.
Al-Jurani said the bomber blew himself up as Jawad's guards tried to stop the attacker.
Also on Monday, a suicide truck bomber killed six people on the road between northwestern Tal Afar and Mosul, police said.