Developing and optimizing small-molecule biosensors is a central goal of synthetic biology. Here we incorporate additional cellular components to improve biosensor sensitivity by preventing target molecules from diffusing out of cells. We demonstrate that trapping erythromycin within Escherichia coli through phosphorylation increases the sensitivity of its biosensor (MphR) by approximately 10-fold. When combined with prior engineering efforts, our optimized biosensor can detect erythromycin concentrations as low as 13 nM. We show that this strategy works with a range of macrolide substrates, enabling the potential usage of our optimized system for drug development and metabolic engineering. This strategy can be extended in future studies to improve the sensitivity of other biosensors. Our findings further suggest that many naturally evolved genes involved in resistance to multiple classes of antibiotics may increase intracellular drug concentrations to modulate their own expression, acting as a form of regulatory feedback.