Zn0.95-xMgxNi0.05O nanoparticles were synthesized using sol-gel technique by varying x values from 0.01 to 0.05 in step of 0.01. The annealing temperature was optimized and 4% Ar-H-2 gas was used for the annealing process to obtain single phase Zn0.95-xMgxNi0.05O samples. The possible lost weights of samples in a wide temperature range for Zn0.95-xMgxNi0.05O samples were investigated by differential thermal analysis and thermo gravimetric analysis. X-ray diffraction of Zn0.95-xMgxNi0.05O samples exhibited single phase with annealing process under 4% Ar-H-2 gas at 450 degrees C. A structural distortion was revealed by replacing Zn2+ by Mg2+ and Ni2+ due to the ionic radius difference which gave rise to a decrease in the crystallite size. The SEM images showed cluster shape distribution in quasi-spherical particles and were almost observed in all frames with agglomeration. Magnetization measurements were conducted at room temperature for all samples under the DC magnetic field for magnetization curves (M vs. H). The magnetization curves of Mg and Ni-doped ZnO systems exhibited a ferromagnetic behavior at room temperature.