Zone 9 is known for having hot summers and in the heat of summer Basil will continually attempt to bolt to seed.
Bolting is when a plant produces a flowering stem (or stems) before the crop is harvested, in a natural attempt to produce seeds. Once seeds have developed on a basil plant the flavor of the leaves diminishes greatly.
Here is how to prevent it:
Keep the plant in shade.
During the hottest parts of summer, the sun in Zone 9 can be quite intense. The intense sun will cause Basil plants to bolt rather quickly. Keeping the plants in shade (by moving the container, or placing shade cloth above if planted in a bed) will help keep the temperatures down and will reduce the intensity of the sun.
Keep the plant well watered.
While basil does not like to have soggy roots, frequently watering the plant during the heat of summer can help reduce the stress of the heat and sun. Make sure not to over water, allowing the soil to drain properly before watering again.
Harvesting leaves often, sometimes as often as daily. will help reduce the plants attempts to bolt to seed. Frequent harvest will also help keep the plant on growth instead of reproduction helping increase the yield of the plant over the growing season.
During the warmer months of the year basil will grow rapidly and should be trimmed by 1/3 at least once a month. The plant should also be trimmed at the first sign of a flowering stem being produced. This frequent trimming will keep the plant focused on growing more leaves and stems and less focused on producing seeds. Basil flowers form a large bud compared to plant size, which makes it very easy to tell when flowers are about to develop. At first sign of flower development cut the stem about 1” directly bellow the developing flower.