A direct laser writing process has been exploited to fabricate a high order Bragg grating on the surface of a porous silicon slab waveguide. The transmission spectrum of the structure, characterized by a pitch of 10 µm, has been investigated by end-fire coupling on exposure to vapor substances of environmental interest. The analyte molecules substitute the air into the silicon pores, due to the capillary condensation phenomenon, and the transmitted spectrum of the grating shifts towards higher wavelengths. The experimental results have been compared with the theoretical calculations obtained by using the transfer matrix method together with the slab waveguide modal calculation.