Gun violence is a major public health problem and costs the United States $280 billion annually ( 1). Although adolescents are disproportionately impacted (e.g. premature death), we know little about how close adolescents live to deadly gun violence incidents and whether such proximity impacts their socioemotional development ( 2, 3). Moreover, gun violence is likely to shape youth developmental outcomes through biological processes—including functional connectivity within regions of the brain that support emotion processing, salience detection, and physiological stress responses—though little work has examined this hypothesis. Lastly, it is unclear if strong neighborhood social ties can buffer youth from the neurobehavioral effects of gun violence. Within a nationwide birth cohort of 3,444 youth (56% Black, 24% Hispanic) born in large US cities, every additional deadly gun violence incident that occurred within 500 meters of home in the prior year was associated with an increase in behavioral problems by 9.6%, even after accounting for area-level crime and socioeconomic resources. Incidents that occurred closer to a child's home exerted larger effects, and stronger neighborhood social ties offset these associations. In a neuroimaging subsample ( N = 164) of the larger cohort, living near more incidents of gun violence and reporting weaker neighborhood social ties were associated with weaker amygdala–prefrontal functional connectivity during socioemotional processing, a pattern previously linked to less effective emotion regulation. Results provide spatially sensitive evidence for gun violence effects on adolescent behavior, a potential mechanism through which risk is biologically embedded, and ways in which positive community factors offset ecological risk.