Basil plants can flower multiple times, so be vigilant and keep an eye out for new buds. Before the flowers open : Ideally, you should pinch off the flower buds before they open.
When basil flowers, it affects leaf quality. To avoid basil plants flowering, remove any flower stems as soon as possible. Towards the end of the season you could let some basil flowers bloom ...