Gardening Guides How-To March 27, 2026 14 min read

Companion Planting Guide for Pest Control: What to Plant Next to What

Companion planting reduces pest pressure by pairing crops that confuse, repel, or trap insects naturally. Learn the science behind tomato-basil, carrot-onion, and three sisters pairings, plus trap crops, repellent plants, raised bed layouts, and which combinations to avoid.

Companion planting is not folklore. It is applied ecology — the deliberate arrangement of plant species to exploit natural interactions that suppress pests, attract beneficial insects, and improve yields. Gardeners have practiced it for centuries, and modern research is catching up to explain why certain combinations work and others fail. When you plant basil next to tomatoes, you are not following a superstition. You are deploying a volatile organic compound emitter that disrupts the host-finding behavior of whiteflies and aphids. That is science with a trowel in its hand.

The core principle is straightforward: monocultures are easy targets. A solid block of cabbage is a beacon for cabbage moths. A row of nothing but carrots broadcasts chemical signals that carrot rust flies follow like a runway. Mixed plantings break up those signals, create physical barriers, and introduce scents that mask or confuse pest navigation. The more diverse your planting, the harder you make it for any single pest species to find and exploit its preferred host.

This guide covers the combinations that have the strongest evidence behind them — from university research plots to decades of market garden observation. If you are planning a raised bed layout this season, use the spacing calculator to work out how many plants fit in your bed dimensions, then come back here to decide which plants should be neighbors.

The Science Behind Companion Planting

Plants communicate constantly through chemistry. Every leaf, stem, and root emits volatile organic compounds (VOCs) into the air and exudates into the soil. These chemical signals serve multiple purposes — attracting pollinators, warning neighboring plants of herbivore attack, and repelling or confusing insects that would otherwise feed on them.

Pest insects locate host plants primarily through olfaction. A cabbage moth does not see your broccoli from across the garden. It smells it. Brassicas release sulfur-containing glucosinolates that break down into isothiocyanates — the same sharp compounds that give mustard and horseradish their bite. These chemicals are irresistible signals to specialist pests like cabbage moths, flea beetles, and harlequin bugs. When you interplant strong-scented herbs or alliums among your brassicas, you add competing chemical signals that make it harder for pests to zero in on their target.

This mechanism is called associational resistance. A target plant surrounded by non-host species experiences lower pest pressure than the same plant surrounded by its own kind. Research published in the journal Agriculture, Ecosystems and Environment found that polyculture plantings reduced herbivore abundance by an average of 44 percent compared to monocultures. That is not a marginal improvement. That is nearly half the pest pressure eliminated through arrangement alone.

The second mechanism is resource concentration. Specialist pests lay more eggs and spend more time in areas with high concentrations of their host plant. Spreading host plants across a bed and filling the gaps with non-hosts forces pests to travel farther between meals, exposing them to predators and weather. Each gap between host plants is a gauntlet the pest must cross.

The third mechanism involves below-ground interactions. Plant roots exude chemicals that influence the soil microbiome, which in turn affects neighboring plants. Marigold roots release alpha-terthienyl, a compound toxic to root-knot nematodes. Allium roots exude sulfur compounds that suppress soil-borne fungal pathogens. These interactions happen invisibly beneath the soil surface but their effects on plant health are measurable and significant.

Tomato and Basil: The Classic Pairing That Works

The tomato-basil combination is the most frequently cited companion pairing in gardening literature, and it is also one of the best documented. Basil emits a complex bouquet of volatile compounds — linalool, eugenol, methyl chavicol, and others — that have been shown to repel thrips, whiteflies, and aphids in controlled studies. When grown alongside tomatoes, basil creates an aromatic interference that reduces the landing rate of these pests on tomato foliage.

A study conducted at the Federal University of Lavras in Brazil found that tomato plants interplanted with basil had significantly fewer whitefly eggs and nymphs compared to tomatoes grown alone. The effect was strongest when basil plants were positioned upwind of tomatoes, suggesting that airborne volatiles are the primary mechanism. In a raised bed setting, this means placing basil on the side of the bed that faces your prevailing breeze.

Beyond pest suppression, there is evidence that basil improves tomato flavor. The mechanism is debated — some researchers attribute it to shared mycorrhizal networks that transfer flavor-active compounds, while others suggest that mild stress from root competition concentrates sugars in tomato fruit. Whatever the cause, the combination produces good-tasting tomatoes and good-tasting basil, which is a practical win regardless of the underlying science.

Plant basil 12 to 18 inches from tomato stems, with one basil plant for every two tomato plants. Allow basil to flower — the blooms attract hoverflies and parasitoid wasps, both of which are predators of aphids and caterpillars. If you are growing basil primarily for kitchen use, plant a dedicated harvest row elsewhere and let the companion basil go to flower for maximum pest-control benefit.

Carrots and Onions: Mutual Pest Confusion

This pairing is a textbook example of associational resistance working in both directions. Carrot rust flies locate carrots by detecting the volatile compounds released when carrot foliage is bruised or disturbed. Onions emit strong sulfur-based volatiles that mask the carrot scent, making it significantly harder for carrot rust flies to find their target. In the opposite direction, the scent of carrots helps mask onion odor from onion flies.

Research at Wellesbourne in the United Kingdom demonstrated that alternating rows of carrots and onions reduced carrot fly damage by 50 to 75 percent compared to carrot monocultures. The key is true alternation — a row of carrots, then a row of onions, then carrots again — rather than planting a single border of onions around a block of carrots. The volatile masking effect works best when the scent sources are interspersed throughout the planting area.

In a raised bed, this translates to alternating bands across the short dimension of the bed. In a 4x8-foot bed, you might run eight alternating bands: carrots, onions, carrots, onions, and so on. Each band can be 6 inches wide. This gives both crops adequate root space while maximizing the chemical interference between rows.

Leeks and scallions work as substitutes for bulb onions in this pairing. Garlic is also effective but is typically planted in fall for spring harvest, so the timing may not overlap with spring-sown carrots. Chives — which are perennial — make an excellent permanent border plant in beds that include carrots in the rotation.

The Three Sisters: Corn, Beans, and Squash

The three sisters polyculture originated with Indigenous peoples of the Americas and remains one of the most elegant companion planting systems ever developed. Corn provides a vertical structure for pole beans to climb. Beans fix atmospheric nitrogen through root nodule bacteria, enriching the soil for the heavy-feeding corn. Squash spreads its broad leaves across the ground, shading the soil to suppress weeds and retain moisture while its prickly stems deter raccoons and other ground-level browsers.

From a pest management perspective, the three sisters system works through structural complexity. The vertical corn stalks, horizontal squash canopy, and twining bean vines create a three-dimensional habitat that is far more difficult for pest insects to navigate than a flat monoculture. Predatory insects — ground beetles, spiders, parasitoid wasps — thrive in this complex structure because it provides shelter, alternative prey, and hunting surfaces at multiple heights.

The squash component is particularly important for pest management. Squash vines produce cucurbitacin compounds that are toxic to many generalist herbivores while attracting specialist squash bees for pollination. The dense leaf canopy shades out weed seedlings that would otherwise compete with all three crops. And the physical barrier of sprawling vines with rough, hairy stems discourages small mammals from entering the planting area.

In a raised bed, the three sisters require a minimum of a 4x8-foot space. Plant corn in a block of at least nine plants (three rows of three, spaced 12 inches apart) for adequate pollination. Sow two bean seeds at the base of each corn stalk once the corn is 6 inches tall. Plant two or three squash seeds at the edges of the bed. Use a compact squash variety — bush types or short-vine varieties — to keep the planting manageable in a raised bed context.

Trap Crops: Drawing Pests Away From Your Main Harvest

Trap cropping is the strategic use of sacrificial plants that are more attractive to pests than your main crop. The concept is simple: if you give pests something they prefer even more than your tomatoes or cabbages, they will concentrate on the trap crop instead. You can then manage the pest on the trap crop — by hand-picking, removing the entire plant, or applying targeted treatment — without touching your harvest crop.

Nasturtiums are one of the most effective trap crops for aphids. Aphids find nasturtiums irresistible and will colonize them preferentially over nearby vegetables. Plant nasturtiums at the perimeter of your garden or at the ends of raised beds, and check them regularly. When aphid colonies build up on nasturtiums, remove heavily infested leaves and dispose of them, or blast the aphids off with a strong water spray. The nasturtiums absorb the pest pressure that would otherwise land on your beans, lettuce, and brassicas.

Blue Hubbard squash is a legendary trap crop for squash vine borers and cucumber beetles. These pests prefer Blue Hubbard over all other cucurbit varieties by a wide margin. Plant Blue Hubbard on the perimeter of your cucurbit area — one or two plants are enough — and the borers and beetles will concentrate there while leaving your zucchini, butternut, and cucumber plants relatively untouched. Inspect the Blue Hubbard stems weekly and remove any borer eggs or frass you find.

Radishes work as a trap crop for flea beetles. These tiny jumping beetles are attracted to brassica family plants, and radishes are their preferred target. Sow a fast row of radishes near your eggplant, kale, or broccoli transplants. The flea beetles will attack the radish foliage first, giving your main crop time to establish. Radishes grow so quickly that you lose little even if the flea beetles damage them heavily.

Sunflowers serve as trap crops for stink bugs and leaf-footed bugs that would otherwise attack tomatoes and peppers. Plant tall sunflower varieties at the edges of your garden. These bugs are drawn to sunflower heads and stems, and because sunflowers are tall and visible, you can easily scout and hand-pick pests from them.

Repellent Plants: Marigolds, Nasturtiums, and Aromatic Herbs

Marigolds deserve their reputation as pest-repellent plants, but the mechanism is more specific than most gardeners realize. French marigolds (Tagetes patula) and African marigolds (Tagetes erecta) produce alpha-terthienyl in their roots, a compound that kills root-knot nematodes on contact. This is not a vague repellent effect — it is a targeted biocide produced in the rhizosphere. Studies at universities across the world have confirmed that planting marigolds in a bed for a full season significantly reduces nematode populations in the soil for the following one to two years.

Above ground, marigold flowers attract hoverflies and parasitoid wasps — beneficial insects that prey on aphids, caterpillars, and other garden pests. The flowers also attract pollinators, which benefits fruiting crops like tomatoes, peppers, squash, and beans planted nearby. For maximum nematode suppression, grow marigolds densely and let them remain in the bed for the full season rather than pulling them early.

Nasturtiums serve double duty as both trap crops and repellent plants. Their peppery scent, produced by mustard oil glycosides, deters whiteflies, squash bugs, and some beetle species. At the same time, their succulent leaves and stems attract aphids preferentially, pulling them away from more valuable crops. This dual function — repelling some pests while trapping others — makes nasturtiums one of the most versatile companion plants available.

Aromatic herbs as a group provide pest suppression through volatile emissions. Rosemary repels cabbage moths and carrot flies. Thyme deters cabbage worms. Dill and fennel attract parasitoid wasps and lacewings. Cilantro attracts hoverflies and tachinid flies. Mint repels flea beetles, aphids, and ants, though it should be grown in containers to prevent its aggressive spread. A border of mixed herbs around a vegetable bed creates a fragrant wall of chemical confusion that reduces pest incursion significantly.

What NOT to Plant Together

Not all combinations are beneficial. Some plant pairings share pests, compete for resources, or produce allelopathic chemicals that inhibit their neighbors.

Tomatoes and brassicas. Both are heavy feeders that compete for the same nutrients. More importantly, brassicas attract flea beetles and cabbage moths that can also damage tomato foliage. Keep these families in separate beds or at opposite ends of long beds.

Beans and alliums. Onions, garlic, chives, and leeks are documented to inhibit the growth of beans and peas. The sulfur compounds that make alliums effective pest confusers appear to suppress the nitrogen-fixing rhizobium bacteria that legumes depend on. Keep alliums and legumes apart — ideally in different beds.

Fennel and almost everything. Fennel produces anethole and other compounds that inhibit the growth of most garden plants. It suppresses tomatoes, beans, peppers, and brassicas. Grow fennel in its own container or in an isolated section of the garden. It is an excellent beneficial insect attractor, but it needs its own space.

Cucumbers and aromatic herbs. Strong aromatic herbs — sage, mint, and rue in particular — can inhibit cucumber growth and may affect flavor. Dill is an exception and is generally compatible with cucumbers, though let it go to seed and it may cross-attract pests. Keep sage and rue well away from your cucurbit beds.

Potatoes and tomatoes. Both are solanaceous crops susceptible to the same diseases — early blight, late blight, and verticillium wilt. Planting them near each other increases disease transmission risk. They also compete for nutrients in the same root zone. Rotate them so they never occupy adjacent beds in the same season.

Dill and carrots. Despite both being members of the Apiaceae family, mature dill can cross-pollinate with carrots (if both go to flower) and its tall growth shades carrot foliage. Young dill is fine as a short-term companion, but remove it before it bolts or plant it at least 3 feet from your carrot rows.

Raised Bed Companion Planting Layouts

Companion planting in raised beds requires tighter planning than in-ground gardens because space is limited and every square foot matters. Here are three proven layouts for standard 4x8-foot beds. For our full visual layout guide with spacing details, see the companion planting chart for raised beds.

Layout 1: The salad bed. Plant a center row of leaf lettuce flanked by rows of carrots and radishes on one side and scallions and chives on the other. Edge the bed with nasturtiums at both short ends. The lettuce provides partial shade for the radishes during hot weather. The scallions confuse carrot flies. The nasturtiums trap aphids before they reach the lettuce. Harvest radishes first to open space for the lettuce to expand.

Layout 2: The tomato-herb bed. Plant three tomato plants down the center of the bed, staked or caged, with 24-inch spacing. Interplant basil between each tomato. Plant a row of marigolds along the front long edge and a row of parsley along the back long edge. At one short end, add two pepper plants. At the other end, plant a few garlic cloves or a cluster of chives. This layout surrounds your tomatoes with aromatic interference from every direction.

Layout 3: The brassica defense bed. Plant broccoli or cabbage in the center with 18-inch spacing. Alternate rows of onions between every brassica row. Plant thyme and rosemary at both short ends. Sow a fast row of radishes along one long edge as a flea beetle trap crop. Place nasturtiums along the other long edge for aphid trapping. This layout addresses the two main brassica pests — cabbage moths (confused by onion and herb scent) and flea beetles (drawn to the radish trap crop).

Making Companion Planting Work in Practice

Companion planting is not a silver bullet. It is one layer in an integrated pest management strategy. Even the best companion combinations will not eliminate every pest in every season. Extremely high pest populations, unusual weather, or new pest introductions can overwhelm any companion planting scheme. What companion planting does reliably is reduce pest pressure to manageable levels, minimize the need for interventions, and create conditions where beneficial insects can establish and contribute to ongoing pest control.

Start with two or three proven combinations rather than trying to optimize every square foot of your garden in one season. Tomato-basil and carrot-onion are reliable starting points that require no special techniques. Add trap crops and aromatic borders as you gain experience. Keep notes on what works in your specific garden — microclimate, soil conditions, and local pest populations all influence which combinations perform best in your location.

Succession planting adds another dimension. When you pull spent lettuce in midsummer, replace it with basil or marigolds rather than leaving bare soil. When spring radishes finish, sow a late crop of beans in their place. Every gap in your planting is an opportunity to add another companion species and maintain the diversity that keeps pest pressure low throughout the season.

Frequently Asked Questions

Does companion planting actually reduce the need for pesticides?

Yes, when practiced consistently as part of a diverse planting strategy. Research shows polyculture plantings reduce herbivore abundance by roughly 44 percent compared to monocultures. That reduction often brings pest pressure below the threshold where intervention is needed. You may still need to hand-pick occasional caterpillars or blast aphids with water, but broad-spectrum spraying becomes unnecessary in most seasons.

How close do companion plants need to be to the crop they are protecting?

For aromatic interference to work, companion plants should be within 2 to 3 feet of the crop they are protecting. Volatile compounds dissipate quickly in open air, so planting basil at the far end of a 20-foot garden will not help tomatoes at the other end. In raised beds, proximity is naturally built in. Interplant companions directly between crop plants or in adjacent rows for the strongest effect.

Can I companion plant in containers on a patio or balcony?

Absolutely. Container gardening is ideal for companion planting because the plants are close together by necessity. Plant a tomato with basil in a large pot. Grow a container of mixed herbs next to your container vegetables. Place a pot of marigolds near your pepper containers. The same principles apply — aromatic interference, trap cropping, and beneficial insect attraction all work at container scale.

What is the single best companion plant for a vegetable garden?

If you can only add one companion, make it French marigolds. They suppress nematodes in the soil, attract beneficial insects above ground, repel whiteflies, and produce continuous blooms from late spring through frost. They are inexpensive, easy to grow from seed, and tolerate the full sun and heat that most vegetable gardens provide. Plant them as borders, interplant them between rows, or tuck them into any open space.

Do marigolds need to be a specific variety to repel pests?

For nematode suppression, French marigolds (Tagetes patula) are the most effective. African marigolds (Tagetes erecta) also produce alpha-terthienyl but in lower concentrations. Signet marigolds (Tagetes tenuifolia) are less studied for pest suppression but are excellent for attracting beneficial insects. Avoid ornamental marigolds in the Calendula genus — they are a different plant entirely and do not produce the same pest-suppressive compounds.

Keep reading