The paper stresses the issue of strong temperature influence on the gain of a Silicon Photomultiplier (SiPM). High sensitivity of the detector to light (single photons) requires stable parameters during measurement, including gain. The paper presents a method of compensating the change of gain caused by temperature variations, by adjusting a suitable voltage bias provided by a precise power module. The methodology of the research takes in account applications with a large number of SiPMs (20 thousand), explains the challenges and presents the results of the gain stabilization algorithm.