Plant asparagus to provide a chemical that has been shown to kill nematodes, a common cause of root ailments among tomatoes. Plant carrots to attract beneficial insects.
Plant three basil plants to every tomato to repels flies and mosquitoes. Plant varieties such as cinnamon, Genovese, Italian, red, purple lemon and Thai. Add garlic as well to repel insects.
Plant borage to deter tomato hornworms and cabbage worms; after planting this annual once, it will self seed. Chives can help keep aphids and other general garden pests away. Mint deters white cabbage moths, ants, rodents, flea beetles, fleas and aphids. Mint is invasive, so it helps to plant it in a container even if it is buried in the garden. Plant lemon balm, a mint relative, to improve growth and flavor of tomatoes.
Add marigolds to deter nematodes harmful to tomatoes as well as the tomato worm and general garden pests. French marigolds work well planted in between tomato plants to deter aphids and other pests.
Avoid planting these vegetables near tomatoes to discourage infestation of worms and other pests: cabbage, cauliflower, corn, celery, dill, potatoes, pole beans, fennel, and kohlrabi.