Hemiptera insects exhibit a close relationship to plants and demonstrate a diverse range of dietary preferences, encompassing phytophagy as the predominant feeding habit while a minority engages in carnivorous or haematophagous behaviour. To counteract the challenges posed by phytophagous insects, plants have developed an array of toxic compounds, causing significant evolutionary selection pressure on these insects. In this study, we employed a comparative genomics approach to analyse the expansion and contraction of gene families specific to phytophagous insect lineages, along with their adaptive evolutionary traits, utilising representative species from the Hemiptera order. Our investigation revealed substantial expansions of gene families within the phytophagous lineages, especially in the Pentatomomorpha branch represented by Oncopeltus fasciatus and Riptortus pedestris. Notably, these expansions of gene families encoding enzymes are potentially involved in hemipteran-plant interactions. Moreover, the adaptive evolutionary analysis of these lineages revealed a higher prevalence of adaptively evolved genes in the Pentatomomorpha branch. The observed branch-specific gene expansions and adaptive evolution likely contribute significantly to the diversification of species within Hemiptera. These results help enhance our understanding of the genomic characteristics of the evolution of different feeding habits in hemipteran insects.