Doping impurity into ZnO is an effective and powerful technique to tailor structures and enhance its optical properties. In this work, Zn1−xMgxO and Zn1−x−yMgxByO nanoparticles (x = 0, 0.1, 0.2, 0.3, 0.4; y = 0, 0.02, 0.04) were synthesized via one-pot method. It shows that the Mg and B dopants has great influence on crystallinity and surface morphology of ZnO nanoparticles, without changing the wurtzite structure of ZnO. The band structure study indicates that the competition of Conductive Band (CB) shift, Burstein–Moss (B-M) shift and Shrinkage effect will cause the band gap energy change in ZnO.