The lack of an engaging pedagogy and the highly competitive atmosphere in introductory science courses tend to discourage students from pursuing science, technology, engineering, and mathematics (STEM) majors. Once in a STEM field, academic and social integration has been long thought to be important for students’ persistence. Yet, it is rarely investigated. In particular, the relative impact of in-class and out-of-class interactions remains an open issue. Here, we demonstrate that, surprisingly, for students whose grades fall in the “middle of the pack,” the out-of-class network is the most significant predictor of persistence. To do so, we use logistic regression combined with Akaike’s information criterion to assess in- and out-of-class networks, grades, and other factors. For students with grades at the very top (and bottom), final grade, unsurprisingly, is the best predictor of persistence—these students are likely already committed (or simply restricted from continuing) so they persist (or drop out). For intermediate grades, though, only out-of-class closeness—a measure of one’s immersion in the network—helps predict persistence. This does not negate the need for in-class ties. However, it suggests that, in this cohort, only students that get past the convenient in-class interactions and start forming strong bonds outside of class are or become committed to their studies. Since many students are lost through attrition, our results suggest practical routes for increasing students’ persistence in STEM majors.