Taste drives appropriate food preference and intake. In Drosophila, taste neurons are housed in both external and internal organs, but the latter have been relatively underexplored. Here, we report that Poxn mutants with a minimal taste system of pharyngeal neurons can avoid many aversive tastants, including bitter compounds, acid, and salt, suggesting that pharyngeal taste is sufficient for rejecting intake of aversive compounds. Optogenetic activation of selected pharyngeal bitter neurons during feeding events elicits changes in feeding parameters that can suppress intake. Functional dissection experiments indicate that multiple classes of pharyngeal neurons are involved in achieving behavioral avoidance, by virtue of being inhibited or activated by aversive tastants. Tracing second-order pharyngeal circuits reveals two main relay centers for processing pharyngeal taste inputs. Together, our results suggest that the pharynx can control the ingestion of harmful compounds by integrating taste input from different classes of pharyngeal neurons.