Porous silicon microcavities (PSM) optical crystals consisting of a Fabry-Perot microcavity embedded between two distributed Bragg reflectors have been fabricated by electrochemical etching. Scanning electron microscopy (SEM) clearly depicted their physical sandwich construction. The optical feature of the PSM structure was tuned by varying the anodization parameters. Through proper thermal oxidation and surface chemical modifications, the resulting structures were employed as optical sensors for the detection of environmental pollutants including volatile organic vapors (i.e. acetonitrile, toluene, cyclohexane, chloroform, acetone and ethanol) and interior decoration gases (i.e. toluene, ammonia and formaldehyde). Fourier transform infrared spectroscopy (FTIR) spectra confirmed the effective thermal annealing and surface modification chemistry, and the sensing process was accompanied by recording the modified structures' optical responses when exposed to target analytes. The PSM optical sensors showed good stability, sensitivity and selectivity, implying promising applications in gas sensing and environmental monitoring.porous silicon microcavity, optical sensor, thermal oxidation, surface modification, environmental pollutants detection