The Drosophila larva has a simple peripheral nervous system with a comparably small number of sensory neurons located externally at the head or internally along the pharynx to assess its chemical environment. It is assumed that larval taste coding occurs mainly via external organs (the dorsal, terminal, and ventral organ). However, the contribution of the internal pharyngeal sensory organs has not been explored. Here we find that larvae require a single pharyngeal gustatory receptor neuron pair called D1, which is located in the dorsal pharyngeal sensilla, in order to avoid caffeine and to associate an odor with caffeine punishment. In contrast, caffeine-driven reduction in feeding in non-choice situations does not require D1. Hence, this work provides data on taste coding via different receptor neurons, depending on the behavioral context. Furthermore, we show that the larval pharyngeal system is involved in bitter tasting. Using ectopic expressions, we show that the caffeine receptor in neuron D1 requires the function of at least four receptor genes: the putative co-receptors Gr33a, Gr66a, the putative caffeine-specific receptor Gr93a, and yet unknown additional molecular component(s). This suggests that larval taste perception is more complex than previously assumed already at the sensory level. Taste information from different sensory organs located outside at the head or inside along the pharynx of the larva is assembled to trigger taste guided behaviors.