In the United States, girls outperform boys in measures of reading achievement while generally underperforming in science and mathematics. One major class of explanations for these gaps involves the gender-based interactions between students and teachers (e.g., role-model and Pygmalion effects). However, the evidence on whether these interactions actually matter is limited and contradictory. In this study, I present new empirical evidence on whether assignment to a same-gender teacher influences student achievement, teacher perceptions of student performance, and student engagement. This study's identification strategy exploits a unique matched pairs feature of a major longitudinal survey. Within-student comparisons based on these data indicate that assignment to a same-gender teacher significantly improves the achievement of both girls and boys as well as teacher perceptions of student performance and student engagement with the teacher's subject. For example, assignment to a female science teacher increases the likelihood that a girl views science as useful for her future. However, because the middle-school teachers in most academic subjects are female, these results also suggest that the gender dynamics between teachers and students at this level amplify boys' large underperformance in reading while attenuating the more modest underperformance of girls in math and science.