The recent discovery of riboswitches in diverse species of bacteria and few eukaryotes added metabolite-responsive gene regulation to the growing list of RNA functions in biology. The natural riboswitches have inspired several designs of synthetic analogues capable of gene regulation in response to a small molecule trigger. In this work, we describe our efforts to engineer complex riboswitches capable of sensing and responding to two small molecules according to Boolean logics AND and NAND. Two aptamers that recognize theophylline and thiamine pyrophosphate were embedded in tandem in the 5' UTR of bacterial mRNA, and riboswitches that function as logic gates were isolated by dual genetic selection. The diverse phenotype of the engineered logic gates supports the versatility of RNA-based gene regulation which may have preceded the modern protein-based gene regulators. Additionally, our design strategy advances our ability to harness the versatile capacities of RNA to program complex behavior in bacteria without the use of engineered proteins.