One‐dimensional photonic crystals constructed from multilayered stacks of porous Si are used as sensors for gas‐phase volatile organic compounds (VOCs). The ability of a double‐stack structure to provide compensation for drift due to changing relative humidity (RH) is investigated. In this approach, two separate photonic crystals (dielectric stacks) are etched into a crystalline Si substrate, one on top of the other. The top stack is chemically modified to be hydrophobic (by hydrosilylation with dodecene) and the bottom stack is made hydrophilic (by hydrosilylation with undecylenic acid). It is shown that the optical spectrum of the double‐stack structure provides an effective means to discriminate VOCs from water vapor. In this approach, shifts in the peak frequencies from both photonic crystals are measured simultaneously. Because the two stacks respond differently to water and to VOC, the effect of changing humidity can be nulled by calculating the weighted difference between the two peak frequencies. Reliable determination of the concentration of VOC vapor in nitrogen over a range of RH values (25% < RH < 75%) is demonstrated. The ability of the double‐stack structure to discriminate between water vapor and VOCs is quantified for four different VOCs: toluene, dimethyl methylphosphonate (DMMP), heptane, and ethanol.