How do living cells maintain a chemical balance?
There are a wide variety of functions taking place inside the cell, many of which involve chemicals; it's difficult to refer to any single mechanism controlling the balance of chemicals, unless we refer to homeostasis itself.
Homeostasis is often compared to a thermostat; it's the ability of a system to sense whether or not a certain condition has been met, and adjust itself up or down in response to any change in that condition. Homeostasis can apply to individual systems within the cell, as well as the overall functioning of the cell itself; we might refer to overall cellular homeostasis as being a chemical balance.
The primary means by which the cell maintains balance is via sensors; without being able to detect whether the system is in balance or not, the cell would not know what to do to maintain it. Some of the sensor systems that the cell uses are enzymes and receptors. For example, when a receptor picks up a signal, it may change a physical structure or release a different chemical signal that helps the cell adapt.
One important point to make here is that, sometimes, maintaining a balance within the cell may be more a matter of maintaining a balance within the body; for example, if a cell is infected by a disease, it may self-destruct in a process called apoptosis. Would we consider this to be a balance? Perhaps not, but it does serve the entire body by maintaining a balance of healthy cells.