We study the peer effects on school achievement exploiting the network structure of friendships within a classroom. In particular, we focus on the role of heterogeneity in network peer effects by accounting for network-specific factors and different driving mechanisms of peer behavior. For this purpose we propose a novel Instrumental Variable--Minimum Distance (IV-MD) estimation approach. Our empirical findings are based on a unique network dataset from the German upper secondary schools. We show that accounting for heterogeneity is not only crucial from a statistical perspective, but also yields new structural insights into how class size and gender composition affect school achievement through peer behavior.