Plant basil, carrots, onions, and marigolds alongside tomatoes for pest control and better yields

Companion planting works because certain plants help each other grow stronger, repel pests that target tomatoes, or use garden space more efficiently. Basil improves tomato flavor and repels spider mites and whiteflies. Carrots and onions grow below the tomato canopy without competing for light, and their strong smell masks tomatoes from some insects. Marigolds attract beneficial insects and deter nematodes in the soil. The key is choosing plants that won't shade your tomatoes or steal the nutrients they need most.

A raised bed gives you control over soil depth and spacing, which makes companion planting easier than in-ground gardens. You can plant shallow-rooted herbs and vegetables around the base of tomato stakes without worrying about root competition, and you'll see results faster because the soil warms up earlier in spring.

Key Takeaways

  • Basil, carrots, onions, and marigolds are the most reliable companions for tomatoes and each serves a different purpose—flavor, pest control, or soil health.
  • Plant shallow-rooted herbs and vegetables on the edges or between tomato plants to avoid shading them or competing for deep nutrients.
  • Avoid planting brassicas (cabbage, broccoli, kale) and fennel near tomatoes because they inhibit tomato growth and attract overlapping pests.
  • Space tomato plants 24 to 36 inches apart in a raised bed to leave room for companions and allow air circulation that prevents fungal disease.
  • Plant companions at the same time as tomatoes or wait until tomatoes are established, depending on the companion's growth speed and root depth.

Basil: flavor and pest control in one plant

Basil is the most useful tomato companion because it improves the taste of tomatoes and repels common pests at the same time. Plant basil 6 to 12 inches from the base of each tomato plant. It grows quickly—ready to harvest in 3 to 4 weeks—and stays low enough not to shade the tomato foliage. The strong smell of basil confuses spider mites, whiteflies, and some beetles that feed on tomato leaves.

Use sweet basil, Thai basil, or African blue basil; all three work equally well as companions. Pinch off the flower buds as they form to keep the plant bushy and productive. If basil flowers and sets seed, it will stop growing new leaves, but you can let it flower late in the season if you want to save seeds for next year. Water basil at the soil level, not on the leaves, to prevent fungal spots.

Carrots and onions: root vegetables that share space without competing

Carrots and onions grow in the top 6 to 8 inches of soil, while tomato roots go much deeper. This means they occupy different soil layers and don't fight for the same nutrients. Plant carrots in rows between tomato plants or around the edges of the bed. Thin seedlings to 2 to 3 inches apart once they sprout. Carrots take 60 to 80 days to mature, so plant them at the same time as tomatoes if you want to harvest together.

Onions (from sets or transplants) grow slowly and won't shade tomatoes. Space them 4 to 6 inches apart. The sulfur compounds in onion skin and roots repel some soil-dwelling pests and may reduce fungal disease pressure. Both carrots and onions tolerate partial shade from the tomato canopy, so they're ideal for the edges of a raised bed where tomato plants cast afternoon shadow.

Marigolds: pest deterrent and beneficial insect magnet

Marigolds (Tagetes species) are planted specifically to repel nematodes—microscopic worms that live in soil and damage tomato roots. Plant marigolds around the perimeter of the raised bed or scattered between tomato plants. They bloom continuously from early summer through frost and attract hoverflies and parasitic wasps, which hunt the insects that eat tomato leaves.

Marigolds need full sun and well-draining soil, so they thrive in the same conditions as tomatoes. Deadhead spent flowers (pinch them off) to keep blooms coming all season. The flowers are edible and mildly peppery; you can harvest them for salads or tea. Marigolds are inexpensive to start from seed or buy as transplants, making them one of the cheapest pest-control tools in the garden.

Plants to avoid near tomatoes

Brassicas—cabbage, broccoli, kale, and cauliflower—release compounds that slow tomato growth. They also attract the same pests (cabbage moths, flea beetles) that target tomatoes, so planting them together concentrates the problem. Keep brassicas in a separate bed or at least 3 feet away from tomatoes.

Fennel inhibits the growth of most vegetables, including tomatoes, and should not be planted in the same bed. Potatoes are susceptible to early blight, a fungal disease that also affects tomatoes; if one plant gets sick, the other will likely follow. Corn and tomatoes compete for nitrogen and space, so they're poor companions in a raised bed where room is limited. Dill can attract hornworms, the same pest that devastates tomato plants, so save dill for a separate area of the garden.

Spacing and timing for a productive raised bed

Space tomato plants 24 to 36 inches apart, depending on the variety. Determinate (bush) tomatoes need less space than indeterminate (vining) types. This spacing leaves room for companions at the edges and between plants without crowding. In a 4-by-8-foot raised bed, you can fit 4 to 6 tomato plants comfortably, with room for basil, carrots, onions, and marigolds around them.

Plant tomatoes first, then add companions once the tomatoes are 6 to 8 inches tall and their root systems are established. This prevents young tomato seedlings from being shaded or outcompeted while they're still fragile. If you're starting everything from seed indoors, you can plant them all at the same time in the raised bed, but space companions farther away initially and move them closer as tomatoes grow. Water all plants at the soil level to keep foliage dry and reduce fungal disease.

Herbs that work in smaller spaces

If your raised bed is narrow or you want to maximize tomato space, plant herbs in containers next to the bed instead of in it. Parsley, oregano, thyme, and chives all repel some tomato pests and take up minimal room. A 6-inch pot of basil or parsley sits flush against the edge of a raised bed and can be moved if you need to access the tomatoes for pruning or harvesting.

Herbs in containers also dry out faster than soil in a raised bed, so they need more frequent watering. Group containers together and water them in the morning to keep the routine straightforward. At the end of the season, you can bring herb containers indoors to a sunny windowsill and harvest fresh herbs through fall and early winter.

Frequently Asked Questions

Can I plant lettuce or spinach with tomatoes?

Yes. Lettuce and spinach grow in cool weather and will bolt (go to seed) once temperatures rise, so plant them early in spring around young tomato plants. They'll mature and be harvested before the tomato canopy gets dense enough to shade them. In late summer, replant lettuce and spinach for a fall crop after tomatoes start declining.

Will companion plants reduce my tomato yield?

No, if you space them correctly. Companions planted at the edges or between tomatoes actually increase yield by reducing pest damage and improving soil health. The key is not planting them so close that they shade the tomato foliage or compete for the deep nutrients tomatoes need. Basil and marigolds especially improve yields by keeping pests under control.

What if I don't have room for companions in my raised bed?

Focus on basil alone—it's the highest-impact companion and takes up minimal space. Plant one basil plant per tomato plant, 6 to 12 inches from the stem. If space is extremely tight, grow basil in a pot next to the bed. You'll still get the pest-control and flavor benefits without sacrificing tomato growing room.

Can I plant tomatoes with beans or peas?

Yes, but with limits. Pole beans and peas can be trellised on the same structure as indeterminate tomatoes if you give each plant its own vertical space. Bush beans and peas work better because they stay low and won't tangle with tomato vines. Both add nitrogen to the soil as they grow, which benefits tomatoes. Plant them at the same time and make sure they don't shade the tomato foliage.

When should I plant companions if I'm starting with transplants?

Plant tomato transplants first and let them establish for a week or two, then add companions. This gives tomato roots time to settle into the raised bed soil. If you're planting basil, you can add it at the same time as tomatoes since both are transplants and will grow at similar rates. Carrots and onions from seed should go in at the same time as tomatoes so they mature on schedule.