Nanoporous carbon matrix was prepared by the sol–gel process from pyrogallol-formaldehyde (PF) mixtures in water using picric acid as catalyst. For the second sample, nickel oxide nanoparticles were added in the PF matrix to get a PF/NiO hybrid organic/inorganic nanocomposite. After a drying step, the samples were heat treated for two hours at 650 °C in tubular furnace under open nitrogen atmosphere. The XRD analysis shows that PF matrix is amorphous while PF/NiO nanocomposite exhibited a metallic phase of nickel. The average value of the metallic nickel crystallites deduced from the Scherrer’s equation was found to be about 35 nm. TEM images indicate the existence of nanopores in the PF matrix and the presence of nickel nanoparticles in the PF/NiO nanocomposite which are dispersed randomly in the carbon matrix. The adsorption–desorption of nitrogen revealed that the pore size equal to 1.9 nm for PF matrix and 2.6 nm for PF/NiO nanocomposite. So, the adsorption capacities of carbon dioxide (CO2) and methane (CH4) show that the PF matrix has the highest adsorption at low pressures where micropores are dominant and the PF/NiO nanocomposite tends to adsorb gases better at high pressure where the presence of mesopores. The V(I) characteristics showed that the PF/NiO nanocomposite can be considered as a smart material. Indeed, the characteristic behavior can be adjusted according to the maximum applied current. Electrochemical measurements have shown that the PF/NiO nanocomposite is very promising for the detection of non-enzymatic glucose with a sensitivity of 76 µA/mM.cm−2 and a detection limit lower than 0.03 µM. The absorption spectra showed that the addition of the NiO nanoparticles increased the Urbach energy and the disorder in the PF/NiO nanocomposite.