In Caenorhabditis elegans the Toll-interleukin receptor domain adaptor protein TIR-1 via a conserved mitogen-activated protein kinase (MAPK) signaling cascade induces innate immunity and upregulates serotonin (5-HT) biosynthesis gene tph-1 in a pair of ADF chemosensory neurons in response to infection. Here, we identify transcription factors downstream of the TIR-1 signaling pathway. We show that common transcription factors control the innate immunity and 5-HT biosynthesis. We demonstrate that a cysteine to tyrosine substitution in an ARM motif of the HEAT/Arm repeat region of the TIR-1 protein confers TIR-1 hyperactivation, leading to constitutive tph-1 upregulation in the ADF neurons, increased expression of intestinal antimicrobial genes, and enhanced resistance to killing by the human opportunistic pathogen Pseudomonas aeruginosa PA14. A forward genetic screen for suppressors of the hyperactive TIR-1 led to the identification of DAF-19, an ortholog of regulatory factor X (RFX) transcription factors that are required for human adaptive immunity. We show that DAF-19 concerts with ATF-7, a member of the activating transcription factor (ATF)/cAMP response element-binding B (CREB) family of transcription factors, to regulate tph-1 and antimicrobial genes, reminiscent of RFX-CREB interaction in human immune cells. daf-19 mutants display heightened susceptibility to killing by PA14. Remarkably, whereas the TIR-1-MAPK-DAF-19/ATF-7 pathway in the intestinal immunity is regulated by DKF-2/protein kinase D, we found that the regulation of tph-1 expression is independent of DKF-2 but requires UNC-43/Ca(2+)/calmodulin-dependent protein kinase (CaMK) II. Our results suggest that pathogenic cues trigger a common core-signaling pathway via tissue-specific mechanisms and demonstrate a novel role for RFX factors in neuronal and innate immune responses to infection.