A highly ordered porous film was fabricated by the sol-gel process using 3-mercaptopropyltrimethoxysilane (MPTMS) precursor and polystyrene microspheres template. The liquid crystal (LC) (4-(Octyloxy) benzoic acid) (OBA) was entrapped into the voids of the pre-fabricated porous structure to obtain sensing materials that were characterized by scanning electron microscope (SEM) and fourier transform infrared spectroscopy (FT-IR). The impedance of the films was measured and the capacitive reactance response (1/-X) of LC-based sensor exhibited satisfactory linear correlation (R-2=0.9994) with the concentration of ammonia up to 50 ppm with a limit of detection (LOD) and quantification of 1.2 ppm and 4.0 ppm, respectively. The sensor exhibited high selectivity to ammonia compared to the different classes of solvent vapors, and satisfactory repeatability (RSD=4 %) and response time (10 min). Also, inverse gas chromatography (IGC) was used to confirm the acidic surface behavior of LC and its selectivity to ammonia. The results proved that the studied LC-based sensor may be promise candidate for sensitive and selective determination of ammonia.