BackgroundIt is important to determine whether unhealthy behaviours might influence transitions out of employment from midlife to old age, given the anticipated need for adults to work for longer. Our aim was to determine the association between repeated assessments of cigarette smoking, heavy/problem alcohol drinking, low physical activity and poor diet at midlife, in relation to work exit from midlife to old age.MethodsData from 7704 participants (5392 men) from the Whitehall II cohort study in employment at midlife were used to evaluate the association between unhealthy behaviours and a subsequent transition out of work during 22 years follow-up, using logistic regression models.ResultsMen who smoked cigarettes, consistently drank alcohol heavily, or reported problem drinking, were more likely to leave employment over follow-up. Women with a consistently poor diet were more likely to leave employment. Associations were stronger when the reason for leaving was health grounds, and stronger among those with persistently unhealthy behaviours over follow-up. The size of the effects were broadly equivalent to one advancing year of age on employment. Physical health functioning over follow-up only partly accounted for the associations with work exit, whereas physical and mental functioning accounted for most of the associations with work exit on health grounds.ConclusionsUnhealthy behaviours in midlife are associated with transitions out of employment into old age. Promoting healthy behaviours at midlife might support current policy initiatives aimed at extending working life. Future research should consider possible mechanisms that link behaviours to transitions out of employment, and consider sex differences in larger cohorts.Electronic supplementary materialThe online version of this article (doi:10.1186/s12889-016-3970-4) contains supplementary material, which is available to authorized users.