Be a Basil Bully!
Do you want to know how to increase the flavor of the herbs in your garden?
Be mean to them!
That is pretty much it, but let me elaborate a little. The flavorful element in an herb comes from specific chemical compounds, often called "essential oils" when extracted from an herb, that give that herb its specific scent and flavor. These compounds are created by the plant mainly to attract pollinators (bees, moths, butterflies, flies, etc) or repel predators (insects, birds, grazers, etc), although there are other reasons, and I bet many that we don't even understand as of yet.
These compounds are created by the plant in various concentrations. So how do we increase the concentration in our herbs? Well, remember that the plant really has one goal... to reproduce itself. If a plant is growing in ideal conditions, then it can take its time and grow big and lush. The problem is that when this happens, the "essential oil" concentration typically drops.
If the herb is feeling stressed, feeling like the conditions in which it is living is not ideal, that it may be eating or killed soon, then it will want to do everything in its power to procreate itself as fast as possible. Of course this is not a thought out process. It is part of its genetic coding. It will increase the production of these special compounds to either protect itself more or attract more pollinators. The increased production of these compounds, the higher the concentration, and the greater the aroma and flavor.
Now to be honest, the concentration change in some herbs will be so minimal that we cannot smell or taste it. Maybe a bee or caterpillar can. Who knows? What I do know is that I have had basil that tastes more like iceberg lettuce when it is growing in rich, loamy, moist soil and that basil is a lush bush over 3 feet tall. Then I have tasted basil that grew from reseeding. It was a bit out of the garden by a sidewalk, in hard, dry, compacted soil, and the plant was only about 6 inches tall. The flavor from one leaf was so intense and the smell so strong, it probably had more of the special basil chemical compounds than that whole lush basil bush with the bland flavor.
My recommendation is to place your herbs in minimally prepared soil. Intentionally avoid watering them as much as you do your vegetables. Let them get beat up a bit by intense heat, drought, and pests before you go and save them. Treat them like you don't really like them. Be mean to them!
For additional reading on how the growing conditions of a plant affect its flavor, read my article on Terroir.