MgxZn1-xO (x=0.0–0.20) ternary alloy thin films have been deposited by sol-gel technique and the composition related structural, microstructural, electrical, and optical properties are investigated. All the films have the hexagonal wurtzite structure. In the composition range of 0.05≪x≤0.20, a deviation from the Vegard’s law in the value of c-axis lattice constant is observed. The Mg:Zn ratio in the films is found to be much lower than the nominal values for the composition range of 0.05≪x≤0.20. Nonlinearity in the current-voltage (I-V) characteristics is observed for the composition range of 0.10≪x≤0.20. The optical band gap values of the MgxZn1-xO films vary linearly up to x=0.05 and thereafter the values deviate from the linear fit. The photoluminescence results also show that ultraviolet peak position is gradually shifted towards the higher energy side up to x=0.05, above which the change of the peak positions are random. These results suggest that the solubility limit of MgO in sol-gel MgxZn1-xO thin films lies in the composition range of 0.05≪x≪0.08.