A resistive-type flexible ammonia (NH3) sensor was proposed and developed in this work, which was prepared by depositing polyaniline-cerium dioxide (PANI-CeO2) nanocomposite thin film on flexible polyimide (PI) substrate through in-situ self-assembly method. The effect of CeO2 nanoparticles on the polymerization of aniline was studied by comparing the morphological, structural and chemical features of the pure PANI and PANI-CeO2 nanocomposite, and the dynamic polymerization processes were also recorded and investigated. In this process, an interesting phenomenon was found that the protonation and oxidation degrees of PANI in PANI-CeO2 nanocomposite were improved significantly according to the XPS spectra analysis, which should be ascribed to the synergetic oxidation of CeO2 nanoparticles and ammonium persulfate (APS). Meanwhile, the NH3-sensing performances of the pure PANI and PANI-CeO2 film sensors were evaluated at room temperature (∼25 °C), which showed that the PANI-CeO2 film sensor possessed enhanced response, reduced recovery time, perfect response-concentration linearity, good reproducibility, splendid selectivity, remarkable long-term stability, ultra-low detectable concentration (16 ppb) and theoretical detection limit (0.274 ppb), and outstanding flexibility without significant response decrease after 500 bending/extending cycles. It was speculated that the excellent sensing performances should probably benefit from the gas-sensing enhancement effect of p-n junction, the improved protonation degree and modified morphology of PANI by the addiction of CeO2 nanoparticles. And, the high flexibility might originate from the flexible structure of PANI chains, and the good adhesion and nano-mechanical performance of PANI-CeO2 film. Besides, the effect of relative humidity on the sensing properties of PANI-CeO2 film sensor was also discussed and analyzed. Therefore, the proposed high-performance flexible PANI-CeO2 thin film sensor holds great promise for application into hand-held or wearable electronic devices for trace-level NH3 detection at room temperature.