  The gain of silicon photomultipliers (SiPMs) increases with bias voltage and
decreases with temperature. To operate SiPMs at stable gain, the bias voltage
can be adjusted to compensate temperature changes. We have tested this concept
with 30 SiPMs from three manufacturers (Hamamatsu, KETEK, CPTA) in a climate
chamber at CERN varying the temperature from $1^\circ \rm C$ to $50^\circ \rm
C$. We built an adaptive power supply that used a linear temperature dependence
of the bias voltage readjustment. With one selected bias voltage readjustment,
we stabilized four SiPMs simultaneously. We fulfilled our goal of limiting the
deviation from gain stability in the $20^\circ \rm C-30^\circ C$ temperature
range to less than $\pm 0.5\%$ for most of the tested SiPMs. We have studied
afterpulsing of SiPMs for different temperatures and bias voltages.
