High-performance, low-cost, self-powered deep-ultraviolet photodetectors (DUV-PDs) are essential for military and civil applications. β-Ga2O3 stands alone among all the solar-blind materials in its suitability for use in next-generation DUV-PDs. However, deep traps by oxygen vacancies critically affect the photogenerated carriers, and hence the photodetector’s final efficiency. Notwithstanding, both a lack of and an excess of oxygen in β-Ga2O3 ultimately lead to leakage channels, carrier scattering and sub-bandgap absorption. However, no studies on the impact of extremes of oxygen (oxygen-poor and oxygen-rich) on β-Ga2O3 photodetector efficiency are available in the literature. Therefore, in the present work, we aim to understand the impact of varied oxygen flow rates from 0% to 4% on material properties and photodetector performance. Photoluminescence, time-resolved photoluminescence (TRPL), x-ray photoelectron spectroscopy and the electrical properties of fabricated photodetectors confirmed the critical role of oxygen in β-Ga2O3. TRPL measurements revealed that β-Ga2O3 with 1% oxygen flow had a reported shortest decay time of nearly 50 ps. A very low dark current of 0.9 pA and a maximum photo-to-dark current of >103 were achieved at zero bias for β-Ga2O3 under optimum oxygen flow. The responsivity, external quantum efficiency, detectivity and dark current for a sample at moderate bias fabricated under optimum oxygen flow were found to be 190.08 A W−1, 9.42 × 104%, 1.22 × 1015 Jones and 21 nA, respectively. Hence, the measurements showed that for better device performance and self-powered response, oxygen concentrations that are neither too low nor too high are needed, and the detailed mechanism behind this is discussed. Comparison of the figures of merit with those of other reported devices in both self-powered and high bias mode reveals the far superior performance of the present device.