Tin oxide (SnOx) thin films at varying oxygen flow rates and Nickel oxide (NiO) thin films were deposited by reactive dc magnetron sputtering on glass substrates. Structural, chemical, morphological, optical and electrical properties of the deposited films were studied. XRD studies confirmed that the deposited films were polycrystalline in nature. SnOx thin films have shown two phases such as SnO and SnO2. AFM and SEM were used to analyse the morphology of the films and EDS confirmed the presence of Sn and Ni in the respective films. The examination of the X-ray photoelectron spectrum showed that the sputtered SnOx films contain both Sn2+ and Sn4+ oxidation states and NiO films contain Ni+2 and Ni+3 oxidation states. Photoluminescence study shows strong violet and weak red emission peaks for SnOx films and NiO showed strong emission peaks in the orange-red region. The optical results demonstrate that the films were transparent. The bandgap of SnOx and NiO samples were ~ 3.3 eV and- 3.42 eV, respectively. Further we constructed a p-NiO/n-SnO2 heterojunction diode and its electrical characteristics were thoroughly assessed. Using dark current-voltage measurements, electrical characteristics such saturation current, ideality factor and barrier height were determined. The increase in oxygen flow rate led to reduction in the rectification of the devices. Our findings support the creation of high-performance metal oxide heterojunction for optoelectronic devices.