There are bacteria normally found in the vagina. Bacterial vaginosis is a condition when these bacteria are replaced with other bacteria that are considered pathological. The usual symptoms include: foul odor coming from the vagina, sometimes stronger after intercourse, and a vaginal discharge. If the infection is spread to the urethra then a frequent urge to urinate and burning sensation when urinating might be present, too. In many cases, there are no symptoms at all.
The treatment includes detecting the bacteria by taking a sample of the vaginal fluid in which the bacteria are detected and consequently treating the patient with adequate antibiotics recommended by a health care provider.
The prevention of the bacterial vaginosis is really hard because the mechanism of bacterial vaginosis (what causes the normal bacteria to be replaced with the pathological) is not well established.
Limiting the number of partners is a good way of preventing transmission. Douching is well known in contributing to bacterial vaginosis so you might avoid that, too. Too frequent douching might change the pH of the vaginal environment, thus making it hostile for the normal bacteria. They are afterwards replaced by more resistant pathological bacteria or by fungi.
Unfortunately, the bacterial vaginosis is one boring, repetitive condition that might keep on coming back as in your case. So, please do not get nervous when it reappears, because taking antibiotics again is the only way for treating it.
You might want to visit your gynecologist for additional information.