AgxNi1-xO transparent conducting oxide film with various Ag mole ratios were prepared via a low-cost sol-gel method, and p-AgxNi1-xO/n-Si heterojunction diodes (HJDs) were fabricated. The effects of various Ag mole ratios on the structure, optical, and electrical properties of AgxNi1-xO films were systematically investigated, and their device applications in p-AgxNi1-xO/n-Si HJDs were examined. The Ag atoms accumulate at grain boundaries and inhibit the grain growth of AgxNi1-xO films. The pristine NiO film exhibits a transmittance exceeding 90% for the visible wavelengths. However, transmittance decreases with the Ag mole ratio. A transmittance hollow occurs at approximately 410 nm in Ag-doped AgxNi1-xO film, attributing to the absorption of surface-plasma-resonance of Ag nanoparticles. The energy gap increases from 3.58 to 3.75 eV for the AgxNi1-xO films with the Ag mole ratio of 0 and 1.8, respectively. Hall measurement indicated that the AgxNi1-xO film is p-type. The pristine NiO film exhibits a very high resistivity (≧106 ohm-cm). The resistivity significantly decreases from 14.8 to 1.88 × 10−4 ohm-cm for the AgxNi1-xO film with the Ag mole ratio of 0.3 and 1.8, respectively. Simultaneously, the hole concentration significantly increases from 1.46 × 1016 to 8.03 × 1022 cm−3. X-ray photoelectron spectroscopy revealed the Ni+3/Ni+2 ratio increases from 0.73 to 1.73 for the AgxNi1-xO films with the Ag mole ratio of 0 and 1.8, respectively. The increased Ni+3/Ni+2 ratio is responsible for increase in the hole concentration. The fabricated p-AgxNi1-xO/n-Si HJDs with Ag mole ratio of 0.5 exhibits a clear rectifying behavior with series resistance and ideality factor of 0.88 kΩ and 2.8, respectively.