The immune and circulatory systems are functionally integrated across insect evolution. In the African malaria mosquito, Anopheles gambiae, immune cells called periostial hemocytes reside around the ostia of the heart, where they phagocytose pathogens in the areas of the body that experience the swiftest hemolymph flow. An infection recruits additional periostial hemocytes, amplifying this heart-associated immune response. Although the structural mechanics of periostial hemocyte aggregation have been defined, the genetic factors that drive heart-associated immune responses remain less understood. Here, we conducted RNAseq analyses and discovered that, during an infection, multiple components of the IMD and JNK pathways are more highly upregulated in periostial hemocytes than in circulating hemocytes or the rest of the abdomen. RNAi-based knockdown showed that the IMD and JNK pathways drive periostial hemocyte aggregation and immune responses on the heart, thereby demonstrating their involvement in the functional integration between the immune and circulatory systems of mosquitoes.