Nonlinear optical coefficients dij were calculated quantitatively for two series of LiNbO3 crystals double-doped with Mg and nonmetallic B obtained by the methods of the solid-phase (SP) synthesis and homogeneous introduction (HG) of impurities. The addition of boron and the presence of MgLi extrinsic defects increased the efficiency of second-harmonic conversion. Homogeneously doped crystals have been found to be the most suitable medium for second-harmonic generation (SHG). The high value of the total nonlinear optical coefficient d33 (-70.742(5)×10-9 cm/statV) and the extremely low photorefractive response make the LiNbO3:Mg:B crystal (4.2 mol%) obtained by the HG method promising for use in nonlinear optics.