Research on wild bees (Apiformes) was conducted in the Lower Oder Valley (NW Poland) at Natura 2000 sites near the border between Poland and Germany. The analysis involved 3 landscape types with xerothermic and sandy grasslands, differing in the proportion of woody vegetation. In total, we collected there 4158 specimens of Apiformes, representing 180 species. We have proved that mid-forest grasslands with a high proportion of thermophilous broad-leaved forests and xerothermic shrub communities are equally attractive to wild bees as open habitats (sandy grasslands, xerothermic grasslands/heaths). We observed varied responses of wild bee species with specific functional characteristics to increasing proportion of woody vegetation. The grasslands surrounded by forests were characterized by the highest number of cleptoparasitic species. In contrast, solitary and social bee species preferred forest-steppe habitats. However, in open habitats, solitary bees were the most abundant. Moreover, open habitats were distinguished by the highest number and abundance of rare species. Active protection of thermophilous grasslands is crucial for biodiversity conservation, also with respect to the natural resources of Apiformes. Preservation of biodiversity in threatened xerothermic and sandy grasslands should be one of the key objectives of nature conservation in European countries. Currently, more and more actions are undertaken to improve their condition and to restore those particularly valuable and threatened habitat types.