Optical switching materials that respond to external stimuli including acidity/alkalinity, redox conditions, temperature, and guest molecules are extremely desirable. This paper reports hydrogen‐bonded organic framework (HOF) films with structure‐dependent optical switching properties in the presence of acidic/alkaline gases. A series of TPPS‐[(bdc)2‐(BIPA‐TC)]n‐HOF films, constructed from terephthalic acid, benzoimidephenanthroline tetracarboxylic acid, and phenylporphyrin sulfonate, were prepared on the surface of a LiNbO3 film composite optical waveguide (COWG) substrate using the solgel method. Upon increasing the drying temperature from 90 to 160 °C, the BIPA‐TC‐HOF‐x film structure evolved from flatter porous to a birds‐nest, and subsequently to a granular structure. The hostguest interactions between the BIPA‐TC‐HOF and the analyte gases induced different degrees of switching in terms of the refractive index. Gas sensing selectivity of the HOF‐x film COWG progressed from EDA sensing to EDA and H2S co‐sensing, and finally to H2S without any interference from the other acid/base gases. This phenomenon was attributed to the variations in the acidity/alkalinity of the BIPA‐TC‐HOF caused by structural changes during the drying process. The gas adsorption kinetics were found to be consistent with Pseudo‐Second‐Order kinetic model. This work provides a novel approach for the development of optic switching sensors.