The tuning of charge carrier concentrations in semiconductor is necessary in order to approach high performance of the electronic and optoelectronic devices. It is demonstrated that the charge-carrier density of single-layer (SL), bilayer (BL), and few-layer (FL) MoS2 nanosheets can be finely and reversibly tuned with N-2 and O-2 gas in the presence of deep-ultraviolet (DUV) light. After exposure to N-2 gas in the presence of DUV light, the threshold voltages of SL, BL, and FL MoS2 field-effect transistors (FETs) shift towards negative gate voltages. The exposure to N-2 gas in the presence of DUV light notably improves the drain-to-source current, carrier density, and charge-carrier mobility for SL, BL, and FL MoS2 FETs. Subsequently, the same devices are exposed to O-2 gas in the presence of DUV light for different periods and the electrical characteristics are completely recovered after a certain time. The doping by using the combination of N-2 and O-2 gas with DUV light provides a stable, effective, and facile approach for improving the performance of MoS2 electronic devices.