Molecular logic gates process physical or chemical “inputs” to generate “outputs” based on a set of logical operators. We report the design and operation of a chemical ensemble in solution that behaves as integrated AND, OR, and XNOR gates with optical input and output signals. The ensemble is composed of a reversible merocyanine-type photoacid and a ruthenium polypyridine complex that functions as a pH-controlled three-state luminescent switch. The light-triggered release of protons from the photoacid is used to control the state of the transition-metal complex. Therefore, the two molecular switching devices communicate with one another through the exchange of ionic signals. By means of such a double (optical–chemical–optical) signal-transduction mechanism, inputs of violet light modulate a luminescence output in the red/far-red region of the visible spectrum. Nondestructive reading is guaranteed because the green light used for excitation in the photoluminescence experiments does not affect the state of the gate. The reset is thermally driven and, thus, does not involve the addition of chemicals and accumulation of byproducts. Owing to its reversibility and stability, this molecular device can afford many cycles of digital operation.