In the case-crossover design (Maclure, 1991, American Journal of Epidemiology 133, 144-153), only cases are sampled, and risk estimates are based on within-subject comparisons of exposures at failure times with exposures at times prior to failure, using matched case-control methods. While the design provides considerable advantages, unidirectional retrospective control sampling (selecting control times only prior to failure) can cause risk estimates to be confounded by time trends in exposure. However, when subsequent exposures are not influenced by failures, as in studies of environmental exposures such as air pollutants, it is possible to determine at times postfailure what a subject's level of exposure would have been had the subject not failed. We describe a bidirectional case-crossover design in which exposures at failure are compared with exposures both before and after failure. Simulation analyses show that relative risk estimates are resistant to confounding by time trend. We also extend the method to studies involving multiple failure times.