A comprehensive understanding of how natural and anthropogenic variation in habitat influences populations requires long-term information on how such variation affects survival and dispersal throughout the annual cycle. Gray jays Perisoreus canadensis are widespread boreal resident passerines that use cached food to survive over the winter and to begin breeding during the late winter. Using multistate capture-recapture analysis, we examined apparent survival and dispersal in relation to habitat quality in a gray jay population over 34 years (1977-2010). Prior evidence suggests that natural variation in habitat quality is driven by the proportion of conifers on territories because of their superior ability to preserve cached food. Although neither adults (>1 year) nor juveniles (<1 year) had higher survival rates on high-conifer territories, both age classes were less likely to leave high-conifer territories and, when they did move, were more likely to disperse to high-conifer territories. In contrast, survival rates were lower on territories that were adjacent to a major highway compared to territories that did not border the highway but there was no evidence for directional dispersal towards or away from highway territories. Our results support the notion that natural variation in habitat quality is driven by the proportion of coniferous trees on territories and provide the first evidence that high-mortality highway habitats can act as an equal-preference ecological trap for birds. Reproductive success, as shown in a previous study, but not survival, is sensitive to natural variation in habitat quality, suggesting that gray jays, despite living in harsh winter conditions, likely favor the allocation of limited resources towards self-maintenance over reproduction.