We show that a student’s ordinal ability rank in a high-school cohort is an important determinant of engaging in risky behaviors. Using longitudinal data from representative US high schools, we find a strong negative effect of rank on the likelihood of smoking, drinking, having unprotected sex and engaging in physical fights. We further provide evidence that these results can be explained by sorting into peer groups and differences in career expectations. Students with a higher rank are less likely to be friends with other students who smoke and drink, while they have higher expectations towards their future educational attainment.