MgxZn1−xO films were grown on quartz substrates at 773 K by using radio frequency magnetron sputtering with a mixture of argon and nitrogen as sputtering gases. The nitrogen concentration in the mixture is characterized by the nitrogen partial pressure ratio, which is determined by the ratio of nitrogen flow rate to the flow rates of nitrogen and argon. It was found that Mg concentration, structure, and band gap of the MgxZn1−xO film could be tuned by changing the nitrogen partial pressure ratio of the sputtering gases. The Mg concentration in the MgxZn1−xO film increases with increasing nitrogen partial pressure ratio. The MgxZn1−xO film consists of wurtzite phase at the ratios from 0% to 50%, mixture of wurtzite and cubic phases at the ratios between 50% and 83%, and cubic phase at 100%. The band gap of the MgxZn1−xO film with wurtzite and cubic structure increases as the ratio rises. The variation of the structure and band gap is attributed to change of the Mg concentration, which results from loss of the O and Zn atoms during growth process, the former is induced by reaction between N and O, and the latter by re-evaporation of Zn atoms due to high substrate temperature. The mechanism of the loss of the O and Zn atoms is discussed based on thermodynamics.