The heads of the Wakali Kwanza and Wakali Wao gangs died between Wednesday evening and Thursday morning.
Four of the leaders of the knife-wielding thugs were shot by police while the fifth one was lynched by a mob.
Police also arrested more than 10 suspected members of the gangs.
Two suspects, identified as Danga and Kadenge, and another were gunned down in Mwandoni in a police raid.
“We received information that the gang had closed a road as they terrorised people,” Christopher Rotich, the Officer Commanding Police Division for Kisauni, said.
He said more than 10 gang members escaped.
Mr Rotich said two others were killed in Mishomorini and Junda. He said police officers engaged the youth, who were armed with machetes and other crude weapons, in running battles as some swam into the Indian Ocean near Nyali.
“We are hunting the rest,” Mr Rotich said. “We cannot have youth giving residents sleepless nights.
He urge parents to take their responsibility seriously.
Police said the suspects were on their radar.
Among those who fled is a suspected notorious criminal identified as Paul Musau.
“We want Paul to surrender or we deal with him,” Mr Rotich warned the suspect.
In Mwandoni, residents praised the police but called for frequent raids on the dens.
“People fear to go to work because of these gangs,” Mr Abbas Dola said.