Semiconductor systems for photocatalytic overall water splitting into H2 and O2 gases typically require metal cocatalyst particles, such as Pt, to efficiently catalyze H2 evolution. However, such metal catalyst surfaces also serve as recombination sites for H2 and O2, forming H2O. We herein report the photon-induced fabrication of microporous SiO2 membranes that can selectively restrict passage of O2 and larger hydrated ions while allowing penetration of protons, water, and H2. The SiO2 layers were selectively photodeposited on Pt nanoparticles on SrTiO3 photocatalyst by using tetramethylammonium (TMA) as a structure-directing agent (SDA), resulting in the formation of core–shell Pt@SiO2 cocatalysts. The resulting photocatalyst exhibited both improved overall water splitting performance under irradiation and with no H2/O2 recombination in the dark. The function of the SiO2 layers was investigated electrochemically by fabricating the SiO2 layers on a Pt electrode via an analogous cathodic deposition protocol. The uniform, dense, yet amorphous layers possess microporosity originating from ring structures formed during the hydrolysis of the silicate precursor in the presence of TMA, suggesting a double-role for TMA in coordinating silicate to cathodic surfaces and in creating a microporous material. The resulting layers were able to function as a molecular sieve, allowing for exclusive H2 generation while excluding unwanted side reactions by O2 or ferricyanide. The SiO2 layer is stable for extended periods of time in photocatalytic conditions, demonstrating promise as a nontoxic material for selective H2 evolution.