A method for synchronizing optical beams in the detection of very weak optical signals carrying classical or quantum information, based on quantum pulse gating implemented using a nonlinear optical medium, characterized in that the lower frequency optical beam leaving the nonlinear medium is monitored by a photodetector connected to an electronic module, the module controls the optical delay line placed in the optical path of either the control beam or the signal beam in such a way that the value of the time-averaged optical signal measured by the photodetector is as small as possible, while the correction of the delay line based on the measured signal occurs continuously or periodically, whereas the higher frequency optical beam leaving the nonlinear medium is measured using an optical signal receiver capable of detecting the optical signal modulated in the modulation format of the transmitter generating the signal beam pulses.