The boundary-layer flow and heat transfer over a non-isothermal stretching sheet in a nanofluid with the effect of magnetic field and thermal radiation have been investigated. The transport equations used for the analysis include the effect of Brownian motion and thermophoresis. The solution for the temperature and nanoparticle concentration depends on six parameters, viz., thermal radiation parameter R, Prandtl number Pr, Lewis number Le, Brownian motion Nb, and the thermophoresis parameter Nt. Similarity transformation is used to convert the governing nonlinear boundary-layer equations into coupled higher order nonlinear ordinary differential equations. These equations were numerically solved using a fourth-order Runge–Kutta method with shooting technique. The analysis has been carried out for two different cases, namely prescribed surface temperature (PST) and prescribed heat flux (PHF) to see the effects of governing parameters for various physical conditions. Numerical results are obtained for distribution of velocity, temperature and concentration, for both cases i.e., prescribed surface temperature and prescribed heat flux, as well as local Nusselt number and Sherwood number. The results indicate that the local Nusselt number decreases with an increase in both Brownian motion parameter Nb and thermophoresis parameter Nt. However, the local Sherwood number increases with an increase in both thermophoresis parameter Nt and Lewis number Le. Besides, it is found that the surface temperature increases with an increase in the Lewis number Le for prescribed heat flux case. A comparison with the previous studies available in the literature has been done and we found an excellent agreement with it.