Theory suggests that neighborhood effects depend not only on where individuals live today, but also on where they lived in the past. Previous research, however, usually measured neighborhood context only once and did not account for length of residence, thereby understating the detrimental effects of long-term neighborhood disadvantage. This study investigates the effects of duration of exposure to disadvantaged neighborhoods on high school graduation. It follows 4,154 children in the PSID, measuring neighborhood context once per year from age 1 to 17. The analysis overcomes the problem of dynamic neighborhood selection by adapting novel methods of causal inference for time-varying treatments. In contrast to previous analyses, these methods do not "control away" the effect of neighborhood context operating indirectly through time-varying characteristics of the family, and thus they capture the full impact of a lifetime of neighborhood disadvantage. We find that sustained exposure to disadvantaged neighborhoods has a severe impact on high school graduation that is considerably larger than effects reported in prior research. Growing up in the most (compared to the least) disadvantaged quintile of neighborhoods is estimated to reduce the probability of graduation from 96% to 76% for black children, and from 95% to 87% for nonblack children.