We aimed to estimate the association between depressive symptoms' trajectories during adolescence and young adulthood and sleep quality in early adulthood. Data from 802 participants of the EPITeen study, evaluated at 13, 17 and 21 years of age, were analysed. Depressive symptoms were assessed using the Beck Depression Inventory-II and three trajectory classes from adolescence to adulthood were previously identified (High, Moderate, Low). The prevalences of poor sleep quality, overall (score>5) and in its specific dimensions: subjective sleep quality, sleep latency, sleep duration, sleep efficiency, sleep disturbance, use of sleep drugs and daytime dysfunction (score≥2), at 21 years of age were evaluated using the Pittsburgh Sleep Quality Index. Associations were estimated using adjusted odds ratio (OR) and the respective 95 % confidence intervals (CI). At 21 years of age, 29.8 % young adults presented poor sleep quality, which was significantly different between those in the Low and High depressive trajectories (14.3 and 53.1 %, respectively, p<0.001). Compared with participants in the Low trajectory, those in the High trajectory were more likely to present poorer sleep quality at 21 years of age (OR=6.34 95 % CI: 3.94-10.21), particularly worse levels of sleep disturbance (OR=5.89 95 % CI: 2.84-12.21), daytime dysfunction (OR=7.63 95 % CI: 3.63-16.06) and subjective sleep quality (OR=6.61 95 % CI: 3.69-11.85). Poor sleep quality in early adulthood was more frequent among individuals who had high levels of depressive symptoms since adolescence. Monitoring depression until adulthood may help to identify those at higher risk of sleep problems which, in turn, can lead to worse health outcomes over time.