Many plants have natural substances in their roots, flowers and leaves that can alternately repel (anti-feedents) and/or attract insects depending on your needs.  In some situations they can also help enhance the growth rate and flavour of other varieties.  Experience shows us that using companion planting throughout the landscape is an important part of integrated pest management, without resorting to chemicals.  In essence, companion planting helps bring a balanced eco-system to your landscape, allowing nature to do its' job.  By using companion planting, many gardeners find that they can discourage harmful pests without losing the beneficial allies.  There are many varieties of herbs and flowers that can be used for companion plants.
Be open to experimenting and find what works for you.  Some possibilities would be using certain plants as a border, backdrop or inter-planting in your flower or vegetable beds where you have specific needs.  Where possible, use plants that are native to your area so the insects you want to attract already know what to look for.

The following list is a basic plant guide to help you "work in harmony' with nature in your garden.  This guide will not solve all your garden problems, as the suggestions may work differently in various situations, or possibly not at all, but don't let that discourage you from giving the ideas a try.
ALFALFA (Medicago sativa)
A perennial that roots deeply, fixes the soil with Nitrogen, accumulates Iron, Magnesium, Phosphorous and Potassium.  Withstands droughts with its long taproot and can improve just about any soil.  Alfalfa has the ability to break up hard clay soil.  It is practically pest and disease free, and  it needs only natural rainfall to survive.
AMARANTH (Amaranthus cordatus)
A tropical annual plant, that needs hot conditions to flourish.  Good with Sweetcorn, its leaves provide shade giving the corn a rich, moist root run.  A host plant to predatory ground beetles.  The young leaves can be eaten in salads.
ANISE (Pimpinella anisum)
Liquorice flavoured herb, good host for predatory Wasps which prey on Aphids, and it is also said to repel Aphids.  It deters pests from Brassicas by camouflaging their odour.  It improves the vigour of any plants growing near it.  It is often used in ointments to protect against bug stings and bites.  Good to plant with Coriander.
ARTEMISIA (Artemisia vulgaris)
Commonly knows as ‘Wormwood’ this helps to keeps animals out of the garden when planted as a border.  An excellent deterrent to most insects too.  A tea made from Wormwood will repel Cabbage Moths, Slugs, Snails, Black Flea Beetles and Fleas effectively.  The two best varieties for making insect spray are ‘Silver King’ and ‘Powis Castle.’  Adversely ‘Powis Castle’ attracts Ladybirds which in turn breed directly on the plant.  ‘Silver Mound’ is great as a border plant and the most toxic wormwood.  Note that Wormwood actually produces a botanical poison, so be careful not to use it directly on food crops.  It can also inhibit plant growth.  To make Wormwood tea, take 200g (8 oz) Wormwood leaves, 4 pints of water, 1 teaspoon castille soap.  Simmer for 30 minutes, stir, strain, and leave to cool.  Add the castille soap to the mixture and use to spray.
BASIL (Ocimum basilicum)
Plant with Tomatoes to improve growth and flavour.  Basil can be helpful in repelling Thrips.  It is said to repel Flies and Mosquitoes.  Do not plant near rue.
BAY (Laurus nobilis)
A fresh Bay leaf in each storage container of beans or grains will deter Weevils and Moths.  Sprinkle dried leaves with other deterrent herbs in the garden as natural insecticide dust.  A good combination is said to be: Bay leaves, Cayenne pepper, Tansy and Peppermint.  For Ladybird invasions try spreading Bay leaves around in your house anywhere they are getting in and they should leave.
BEANS (Phaseolus family)
All Beans enrich the soil with Nitrogen fixed from the air.  In general they are good company for Carrots, Brassicas, Beets, and Cucumbers.  Great for heavy Nitrogen users like corn and grain plants.  French Haricot Beans, Sweetcorn and Melons are considered a good combination.  Keep beans away from the Alliums.
BEE BALM (Monarda didyma)
Also knows as Oswego.  Plant this with Tomatoes to improve growth and flavour.  Great for attracting beneficial insects and Bees of course.  A pretty perennial, but has a tendency to get Powdery Mildew.
BEET (Beta vulgaris)
This is good for adding minerals to the soil.  The leaves are composed of 25% Magnesium.  Companions are Lettuce, Onions and Brassicas.
BORAGE (Borago officinalis)
This is a good companion plant for Tomatoes, Squash and Strawberries.  It deters Tomato Hornworms and Cabbage worms.  One of the best Bee and Wasp attracting plants.  Adds trace minerals to the soil, and a good addition the compost pile.  Borage may benefit any plant it is growing next to via increasing resistance to pests and disease.  After you have planted this annual once it will self seed.
BRASSICA (Cabbage/Kale/Mustard family)
Benefit from Camomile, Peppermint, Dill, Sage, and Rosemary.  They need rich soil with plenty of lime to flourish.
BUCKWHEAT (Fagopyrum esculentum)
This member of the Brassica family accumulates Calcium and can be grown as an excellent cover crop.  It attracts Hoverflies in droves.
CARAWAY (Carum carvi)
Good for loosening compacted soil with its deep roots, although can be tricky to establish.  The flowers attract a number of beneficial insects.
CATNIP (Nepeta cataria)
Deters Flea Beetles, Aphids, Ants and Weevils.  It has been found to repel Mice quite well.
CAMOMILE, GERMAN (Matricaria recutita)
Annual.  It improves the flavour of Cabbages, Cucumbers and Onions.  Host to Hoverflies and Wasps.  Accumulates Calcium, Potassium and Sulphur, later returning them to the soil.  Increases oil production from herbs.  Leave some flowers unpicked and German camomile will reseed itself.  Roman camomile is a low growing perennial that will tolerate almost any soil conditions.  Both like full sun.  Growing camomile of any type is considered a tonic for anything you grow in the garden.
CHERVIL (Anthriscus cerefolium)
This shade-lover is an ideal companion to Radishes for improved growth and flavour. It keeps Aphids off Lettuce.
CHIVES (Allium schoenoprasum)
Improves growth and flavour of both Carrots and Tomatoes.  Chives may drive away Beetles and Carrot fly.  Planted among Apple trees, it may help prevent Scab.  A tea of chives may be used on Cucumbers to prevent Downy Mildew.  To make Chive tea: Put a bunch of chopped Chives in a heat proof glass container, and cover with boiling water.  Let this sit until cool, then strain and spray as often as two to three times a week.
CHRYSANTHEMUM (Chrysanthemum indicum)
Chrysanthemum coccineum kills root Nematodes (the bad ones).  Its flowers along with those of C. cineraraefolium have been used as botanical pesticides for centuries (i.e. pyrethrum).
CLOVER (Trifolium family)
Long used as a green manure and plant companion.  It attracts many beneficials.  Useful planted around Apple trees to attract predators of the Woolly Aphid.
COMFREY (Symphytum officinale)
Accumulates Calcium, Phosphorous and Potassium.  Likes wet spots to grow in.  Traditional medicinal plant.  Good trap crop for slugs.  With its' high levels of potash Comfrey tea can be used as an excellent fertilizer for Tomato, Pepper, Cucumber and Potato plants.  The smell while it is "cooking" is strong.  To make Comfrey Tea, pick a good sized handful of leaves.  Place them in a container with enough water to cover the leaves.  Cover and let this cook for 4 weeks in cool weather or 2 weeks in hot weather.  Then squeeze the leaves to extract as much juice as possible, strain and use at a rate of 1/3 cup of Comfrey juice to one gallon of water.  Use as a foliar feed and soil drench around the plants.  Put the solid wastes into the compost pile.
CORIANDER (Coriandrum sativum)
Repels Aphids, Spider Mites and Potato Beetles.  A tea from this can be used as a spray for Spider Mites.  A partner for Anise.
COSTMARY (Tanacetum balsameta)
This tall perennial of the Chrysanthemum family helps to repel Moths.
DAHLIA (Dahlia family)
These large-flowered tuberous annuals, are said to repel Nematodes (the bad ones).
DEADNETTLE (Lamium family)
This will repel Potato bugs, a big problem for many Gardeners.
DILL (Anethum graveolens)
This improves the growth and health of Cabbage.  Do not plant near Carrots.  Best friend for Lettuce.  Attracts Hoverflies and predatory Wasps.  Repels Aphids and Spider mites to some degree.  Dill does attract the Tomato Horn worm, so it would be useful to plant it somewhere away from your Tomato plants for this reason.
ELDER (Sambucus nigra)
A spray made from the leaves can be used against Aphids, Carrot Root Fly and other pests.  Put branches and leaves in Mole runs to banish them.  Elder leaves also have fungicidal properties and may be useful against both Mildew and Blackspot diseases.  To make the spray: simmer 200g (8 oz) leaves in 400g (16 oz) water for 30 minutes.  Stir this thoroughly, then strain.  Take 400g (16 oz) warm water and mix with 1 tablespoon of castille soap.  Add the soap mixture to the Elder water, and spray as needed.  Note: Set your sprayer to a coarse or large droplet setting as this mixture will tend to plug the nozzle on a fine setting.
FLAX (Linum usisatissimum)
Plant this with both Carrots and Potatoes.  Flax contains Tannin and Linseed oil which some pests dislike.  Flax is a tall annual plant with blue or white flowers, that readily self-sows.
GARLIC (Allium sativum)
Plant near Roses to repel Aphids.  It accumulates Sulphur; a naturally occurring fungicide which will help in the garden with disease prevention.  Garlic is systemic in action as it is taken up by the plants through their pores, and when used as a soil drench is also taken up by the roots.  Has value in deterring Codling Moths, Root Maggots, Snails, and Carrot Root Fly.  Concentrated Garlic sprays have been observed to repel and kill Whiteflies and Aphids among others, with as little as a 6-8% concentration.  It is safe for use on orchids too.  Because Garlic contains naturally occurring Sulphur, it also acts as an antibacterial agent and fungus preventative.

Never use oil sprays on Blue Spruce as it will remove the blue waxy coating on the needles.
GERANIUM (Pelargonium family)
Repels Cabbage Worms and Japanese Beetles, plant around Grapevines, Roses, Corn, and Cabbage.
HORSERADISH (Armoracia rusticana)
Plant in containers in the Potato patch to keep away various Beetles and other bugs.  There are some very effective insect sprays that can be made with the root.  Use the bottomless pot method to keep Horseradish contained.  The root can yield anti-fungal properties when a tea is made from it.  This is especially useful against Brown rot in Apple trees.  The white flesh of the Horseradish root also contains significant amounts of Calcium, Magnesium and Vitamin C.  To make Horseradish tea: Process one cup of roots in food processor till finely chopped.  Combine this with 400g (16 oz) water in a glass container and let soak for 24 hours.  Strain the liquid, and discard the solids.  Now mix the liquid with just under 1 litre (2 pints) water and spray.
HOREHOUND (Marrubium vulgare)
Like many varieties in the mint family, the many tiny flowers attract various parasitic Wasps and Flies.  The larval forms of these insects parasitize or otherwise consume many other pests.  It grows where many others fail to thrive, and can survive harsh winters.  It blooms over a long season, attracting beneficial insects almost as long as you are likely to need them.  For best results use Horehound directly as a companion plant.  It stimulates and aids fruiting in both Tomatoes and Peppers.
HYSSOP (Hyssopus officinalis)
Companion plant to Cabbage and Grapevines, deters Cabbage Moths and Flea Beetles.  Do not plant near Radishes.  Hyssop may be the number one preference among Bees and some Beekeepers rub their Hives with it to encourage the Bees to keep to their home.  It is not as invasive as other members of the mint family, making it safer for inter-planting.
KELP (Various Seaweeds)
When used in a powder mixture or tea as a spray, this versatile seaweed will not only repel insects but feed the vegetables.  In particular we have observed that Kelp foliar sprays keep Aphids away when used as a spray every 8 days before and during infestation times.  If you have access to seaweed, use it as a mulch to keep slugs away.
LARKSPUR (Delphinium family)
An annual member of the Delphinium family, Larkspur will attract and kill Japanese Beetles, which eat it and are poisoned by it.  Larkspur is also poisonous to people.
LAVENDER (Lavandula angustifolia)
Repels Fleas and Moths.  Prolific flowering Lavender nourishes many nectar feeding and beneficial Insects.  Use dried sprigs of Lavender to repel Moths.  Start plants in winter from cuttings, setting them out in spring.
LEEKS (Allium ampeloprasum var. porrum)
Plant Leeks near Carrots, Celery and Onions which will improve their growth.  Leeks also repel Carrot Flies.
LEMON BALM (Melissa officinalis)
Sprinkle throughout the garden in a herbal powder mixture to deter many bugs.  Lemon Balm has Citronella compounds that make this work.  It is said that you can crush and rub the leaves on your skin to keep Mosquitoes away.
LOVAGE (Levisticum officinale)
Improves flavour and health of most plants.  Good habitat for ground beetles. A large plant, use one planted as a backdrop.  Similar to celery in flavour.
MARIGOLD (Tagetes and Calendula families)
These plants are given a lot of credit as a pest deterrent.  They keep the soil free of bad Nematodes, and are supposed to discourage many insects.  Plant freely throughout the garden.  The Marigolds you choose must be a scented variety for them to work.  Unfortunately they do attract Spider Mites and Slugs.

French Marigold (Tagetes patula) has roots that exude a substance which spreads in their immediate vicinity killing Nematodes.  For Nematode control you want to plant dense areas of them.  There have been some studies done that proved this Nematode killing effect lasted for several years.  These marigolds also help to deter Whiteflies when planted around Tomatoes and can be used in Greenhouses for the same purpose.  Whiteflies hate the smell of Marigolds.

Mexican Marigold (Tagetes minuta) is the most powerful of the insect repelling Marigolds and may also overwhelm weed roots such as Bindweed.  It is said to repel the Mexican Bean Beetle and wild Rabbits.  However, be careful, it can have a herbicidal effect on some plants like Beans and Cabbage.
MARJORAM (Origanum majorana)
As a companion plant it improves the flavour of vegetables and herbs.  Sweet Marjoram is the most commonly grown type.
MINT (Mentha longifolia)
Deters White Cabbage Moths, Ants, Rodents, Flea Beetles, Fleas and Aphids, and improves the health of Cabbage and Tomatoes.  Use cuttings as a mulch around members of the Brassica family.  It attracts Hoverflies and predatory Wasps.  Earthworms are quite attracted to Mint plantings.  Be careful where you plant it as Mint is an incredibly invasive perennial.
MORNING GLORY (Convolvulus & Ipomoea families)
They attract Hoverflies.  Plus if you want a fast growing annual vine to cover something up, Morning Glory is an excellent choice.
NASTURTIUMS (Tropaeolum majus)
Plant as a barrier around Tomatoes, Radishes, Cabbage, Cucumbers, and under fruit trees.  Deters Woolly Aphids, Whiteflies, and other pests.  A great trap crop for Aphids.  Likes poor soil with low moisture and no fertilizer.  It has been the practice of some fruit growers that planting Nasturtiums every year in the root zone of fruit trees allow the trees to take up the pungent odour of the plants and repel bugs.  It has no taste effect on the fruit.  The leaves, flowers and seeds are all edible and wonderful in salads.
NETTLES, STINGING (Urtica dioica)
The flowers attract Bees.  Sprays made from these are rich in Silica and Calcium.  Invigorating for plants and improves their disease resistance.  Leaving the mixture to rot, it then makes an excellent liquid feed.  Comfrey improves the liquid feed even more.  Hairs on the Nettles' leaves contain Formic Acid which "stings" you.
PARSLEY (Petroselinum crispum)
Plant among and sprinkle on Tomatoes and Asparagus.  Use as a tea to ward off Asparagus Beetles.  It attracts Hoverflies.  Let some go to seed to attract the tiny parasitic Wasps.  Parsley increases the fragrance of Roses when planted around their base.
PEPPERMINT (Mentha x piperita)
Repels White Cabbage Moths, Aphids and Flea Beetles.  It is the menthol content in mints that acts as an insect repellent.  Bees and other beneficial insects love it.
PEPPERS, HOT (Capsicum family)
Chilli Peppers have root exudates that prevent root rot and other Fusarium diseases.  Plant anywhere you have these problems.  Teas made from hot peppers can be useful as insect sprays.
PENNYROYAL (Mentha pulegium)
Repels Fleas.  Many people are now using Pennyroyal as an alternative Lawn.  The leaves, when crushed and rubbed onto your skin, will repel Flies, Gnats, Mosquitoes and Ticks.
PETUNIA (Petunia family)
They repel the Asparagus Beetle, Leafhoppers, certain Aphids, Tomato Worms amongst other pests.  A good companion to Tomatoes, but useful to plant everywhere.  The leaves can be used in a tea to make a potent bug spray.
POACHED-EGG PLANT (Limnanthes douglasii)
Grow these with Tomatoes, they will attract Hover Flies, which eat Aphids.
PURSLANE (Portulaca family)
This edible weed makes good ground cover in the Corn patch.  You can use the stems, leaves and seeds in stir-frys.  Pickle the green seed pods for Caper substitutes.
RADISH (Raphanus sativus)
Plant Radishes with your Squash plants.  Radishes may protect them from Squash borers.
ROSEMARY (Rosmarinus officinalis)
Companion plant to Cabbage, Beans, Carrots and Sage.  Deters Cabbage Moths, Bean Beetles and Carrot Flies.  Place cuttings by the crowns of Carrots for protection from Carrot Flies.
RUE (Ruta graveolens)
Deters Japanese Beetles in Roses and Raspberries.  To make it even more effective, crush a few leaves to release the smell.  Repels Flies and is said to repel Cats.  Some say you should not plant it near Cabbage, Basil or Sage.  A pretty perennial with bluish-grey leaves.  May be grown indoors on a sunny windowsill.  Rue can cause skin irritation.
SAGE (Salvia officinalis)
Use as a companion plant with Broccoli, Cauliflower, Rosemary, Cabbage and Carrots to deter Cabbage Moths, Beetles, Black Flea Beetles and Carrot Flies.  Do not plant near Cucumbers or Rue.  Allowing Sage to flower will also attract many beneficial insects and the flowers are pretty too.  There are some very striking varieties of sage with variegated foliage that can be used for their ornamental as well as practical qualities.
SOUTHERNWOOD (Artemisia abrotanum)
Plant this with Cabbage, and here and there in the garden.  It has a wonderful Lemony scent when crushed or brushed in passing.  It roots easily from cuttings.  Does not like fertilizer.  It is a perennial that can get quite bushy.  It can be cut back every spring and it comes back in no time.  A delightful plant that is virtually pest free.
SUMMER SAVORY (Satureja hortensis)
Plant with Beans and Onions to improve growth and flavour.  Discourages Cabbage Moths.  Honey bees love it.
SUNFLOWERS (Helianthus annuus)
Planting sunflowers with Corn is said by some to increase the yield.  If Aphids are a problem, plant a few Sunflowers here and there in the garden.  The sunflowers are so tough that the aphids cause very little damage and we have nice seed heads for the birds to enjoy.
TANSY (Tanacetum vulgare)
Plant with fruit trees, Roses and Raspberries keeping in mind that it can be invasive and is not the most attractive of plants.  Tansy is often recommended as an Ant repellent, but may only work on sugar type ants.  These are the ones that you see on peonies and marching into the kitchen.  Placing tansy clippings by the greenhouse door can keep them out.  Deters flying insects, various Beetles, ants and mice.  Hang a bunch of Tansy leaves indoors as a Fly repellent.  Use clippings as a mulch as needed.  Don't be afraid to cut the plant up as it is very resilient, resisting many an effort to remove it.  It is also a helpful addition to the compost pile with its' high Potassium content.

Warning: Do not plant Tansy anywhere that livestock can feed on it as it is toxic to many animals. Do not let it go to seed either as it may germinate in livestock fields.
TARRAGON (Artemisia dracunculus)
Plant throughout the garden, not many pests like this one.  Recommended to enhance growth and flavour of many vegetables.
THYME (Thymus vulgaris)
Deters Cabbage Worms.  Woolly Thyme makes a wonderful groundcover.  You may want to use the upright form of Thyme in the garden rather than the groundcover types.  Thyme is easy to grow from seeds or cuttings.  Older woody plants should be divided in spring.
VALERIAN (Valeriana vulgaris)
Valerian can be planted amongst vegetables, as it stimulates Earthworms which helps to boost plant growth.
YARROW (Achillea millefolium)
Yarrow has insect repelling qualities and is an excellent natural fertilizer.  A handful of Yarrow leaves added to the compost pile really speeds things up.  It also attracts predatory Wasps and Ladybirds.  It is said to increase the essential oil content of herbs when planted among them.