Companion plants that produce copious nectar or pollen in a vegetable garden (insectary plants) may help encourage higher populations of beneficial insects that control pests. 
Some companion herbs that produce aromatic volatiles attract natural enemies, which can help to suppress pests. Mint, basil, and marigold all attract herbivorous insects enemies, such as generalist predators. For instance, spearmint attracts the mirid bug Nesidiocoris tenuis, while basil attracts the green lacewing Ceraeochrysa cubana'.
The multiple interactions between the plant species, and between them, pest species, and the pests natural enemies, are complex and not well understood. A 2019 field study in Brazil found that companion planting with parsley among a target crop of collard greens helped to suppress aphid pests (Brevicoryne brassicae, Myzus persicae'), even though it also cut down the numbers of parasitoid wasps. Predatory insect species increased in numbers, and may have predated on the aphid-killing parasitoids, while the reduction in aphids may have been caused by the increased numbers of generalist predators.