The circulatory and immune systems of mosquitoes are functionally integrated. An infection induces the migration of hemocytes to the dorsal vessel, and specifically, to the regions surrounding the ostia of the heart. These periostial hemocytes phagocytose pathogens in the areas of the hemocoel that experience the highest hemolymph flow. Here, we investigated whether a bacterial infection affects cardiac rhythmicity in the African malaria mosquito, Anopheles gambiae. We discovered that infection with Escherichia coli, Staphylococcus aureus and Staphylococcus epidermidis, but not Micrococcus luteus, reduces the mosquito heart rate and alters the proportional directionality of heart contractions. Infection does not alter the expression of genes encoding crustacean cardioactive peptide (CCAP), FMRFamide, corazonin, neuropeptide F or short neuropeptide F, indicating that they do not drive the cardiac phenotype. Infection upregulates the transcription of two superoxide dismutase (SOD) genes, catalase and a glutathione peroxidase, but dramatically induces upregulation of nitric oxide synthase (NOS) in both the heart and hemocytes. Within the heart, nitric oxide synthase is produced by periostial hemocytes, and chemically inhibiting the production of nitric oxide using l-NAME reverses the infection-induced cardiac phenotype. Finally, infection induces the upregulation of two lysozyme genes in the heart and other tissues, and treating mosquitoes with lysozyme reduces the heart rate in a manner reminiscent of the infection phenotype. These data demonstrate an exciting new facet of the integration between the immune and circulatory systems of insects, whereby a hemocyte-produced factor with immune activity, namely nitric oxide, modulates heart physiology.