Hierarchical three-dimensional (3D) flower-like n-ZnO/p-NiO heterostructures with various ZnxNiy molar ratios (Zn5Ni1, Zn2Ni1, Zn1Ni1, Zn1Ni2 and Zn1Ni5) were synthesized by a facile hydrothermal method. Their crystal phase, surface morphology, elemental composition and chemical state were comprehensively investigated by XRD, SEM, EDS, TEM and XPS techniques. Gas sensing measurements were conducted on all the as-developed ZnxNiy-based sensors toward ammonia (NH3) detection under various working temperatures from 160 to 340 °C. In particular, the as-prepared Zn1Ni2 sensor exhibited superior NH3 sensing performance under optimum working temperature (280 °C) including high response (25 toward 100 ppm), fast response/recovery time (16 s/7 s), low detection limit (50 ppb), good selectivity and long-term stability. The enhanced NH3 sensing capabilities of Zn1Ni2 sensor could be attributed to both the specific hierarchical structure which facilitates the adsorption of NH3 molecules and produces much more contact sites, and the improved gas response characteristics of p-n heterojunctions. The obtained results clear demonstrated that the optimum n-ZnO/p-NiO heterostructure is indeed very promising sensing material toward NH3 detection for different applications.