When basil flowers appear, pinch them off. This encourages the plant to put its energy into producing leaves instead.
It’s difficult to keep basil going in the winter because of the lack of sunshine and chance of frost. Your plant will probably look a bit sorry for itself. However, if you can just keep it alive, give it a pruning and a new pot in the spring, and more than likely the plant will come back as good as ever with the sunshine of spring. You could invest in a growing light if you were keen to keep the same plant, or just grow from seed again in the spring. If you have a productive plant, you could dry some of the leaves, but I would prefer to freeze them as they keep their flavour better.
If there are yellow leaves around the bottom of the plant, it needs more light and hold back on the fertiliser for a bit.