We analyzed the boundary layer flow and heat transfer over a stretching sheet due to nanofluids with the effects of magnetic field, Brownian motion, thermophoresis, viscous dissipation and convective boundary conditions. The transport equations used in the analysis took into account the effect of Brownian motion and thermophoresis parameters. The highly nonlinear partial differential equations governing flow and heat transport are simplified using similarity transformation. Resultant ordinary differential equations are solved numerically using the Runge–Kutta–Fehlberg and Newton–Raphson schemes based on the shooting method. The solutions velocity temperature and nanoparticle concentration depend on parameters such as Brownian motion, thermophoresis parameter, magnetic field and viscous dissipation, which have a significant influence on controlling the dynamics of the considered problem. Comparison with known results for certain particular cases shows an excellent agreement.