Increasing evidence suggests a role for inflammation in neuropsychiatric conditions including autism spectrum disorder (ASD), a neurodevelopmental syndrome with higher prevalence in males than females. Here we examined the effects of early-life immune system activation (EIA)-comprising regimens of prenatal, early postnatal, or combined ("two-hit") immune activation-on the core behavioral features of ASD (decreased social interaction, increased repetitive behavior, and aberrant communication) in C57BL/6J mice. We treated timed-pregnant mice with polyinosinic:polycytidylic acid (Poly I:C) on gestational day 12.5 to produce maternal immune activation (MIA). Some offspring also received lipopolysaccharide (LPS) on postnatal day 9 to produce postnatal immune activation (PIA). EIA produced disruptions in social behavior and increases in repetitive behaviors that were larger in males than in females. Ultrasonic vocalizations (USVs) were altered in both sexes. Molecular studies revealed that EIA also produced prominent sex-specific changes in inflammation-related gene expression in the brain. Whereas both sexes showed increases in pro-inflammatory factors, as reflected by levels of mRNA and protein, expression of anti-inflammatory factors was decreased in males but increased in females. Our findings demonstrate that EIA can produce sex-specific behavioral effects and immune responses in the brain, and identify molecular processes that may contribute to resilience in females.