A planar optical waveguide is manufactured by the functionnalisation of oxidised mesoporous silicon with Bromothymol Blue to achieve a sensitive ammonia sensor suitable for low gas concentrations. The propagated light intensity is measured at the output of the waveguide. The sensitivity at low concentrations and the short time of reaction of the sensor are enhanced by a confinement effect of the gas molecules inside the pores. The dependence of the output signal with gas concentration is demonstrated. When the ammonia flow is stopped, the reversibility of the initial characteristics of the propagated light is naturally obtained with the disappearance of the gas molecules.