Diverse sensory organs, including mammalian taste buds and insect chemosensory sensilla, show a marked compartmentalization of receptor cells; however, the functional impact of this organization remains unclear. Here we show that compartmentalized Drosophila olfactory receptor neurons (ORNs) communicate with each other directly. The sustained response of one ORN is inhibited by the transient activation of a neighbouring ORN. Mechanistically, such lateral inhibition does not depend on synapses and is probably mediated by ephaptic coupling. Moreover, lateral inhibition in the periphery can modulate olfactory behaviour. Together, the results show that integration of olfactory information can occur via lateral interactions between ORNs. Inhibition of a sustained response by a transient response may provide a means of encoding salience. Finally, a CO2-sensitive ORN in the malaria mosquito Anopheles can also be inhibited by excitation of an adjacent ORN, suggesting a broad occurrence of lateral inhibition in insects and possible applications in insect control.