Strengthening online learning outcomes requires the establishment of strong student-teacher relationships to engage students actively in learning activities. Teacher-student relationships are also pivotal factors for enhancing academic motivation for online learning engagement. Generally, however, research on online teaching remains underdeveloped. We aimed, in this study, to investigate the complex interplay in higher education in Pakistan between teacher-student relationships, academic motivation, and online learning engagement. We used Self-Determination Theory to frame an exploration of the impact of positive teacher-student relationships as mediated by intrinsic or extrinsic academic motivation on students’ engagement in online learning activities. We administered a student self-report questionnaire to 437 participants from diverse universities in Sindh province. Using Structural Equation Modeling, we confirmed a model fit in which there were positive correlations between teacher-student relationships and students’ online learning engagement; and between students’ intrinsic and extrinsic academic motivations and their on line learning engagement. Our findings emphasized the need for communication, personalized support, and a sense of belonging in virtual education. Moreover, our findings revealed the mediating role of students’ intrinsic and extrinsic academic motivation in teacher-student relationships, highlighting the nuanced dynamics of academic motivation in the virtual learning environment, with intrinsic motivation having the greatest mediating impact in the relationship between teacher-student relationships and on line learning engagement. Our study’s practical implications include a need for professional educators to foster positive teacher-student relationships and integrate student motivational elements into online course design.