An optoelectronic sensor including: ∘ a receiver arranged for receiving electromagnetic radiation, the receiver comprising a photodetector arranged for transforming the electromagnetic radiation received into a received electrical signal and an amplification stage having variable gain between a minimum gain and a maximum gain arranged for amplifying said received electrical signal; ∘ an emitter arranged for emitting a periodic electromagnetic radiation including a pulse train in each period, each pulse train including n pulses, where n ≥ 2, and wherein each jth pulse with j = 1,....,n of the train having an amplitude equal to: A j = A j − 1 * B ∘ a regulation element configured for the regulation of the gain of the amplification stage of the receiver; characterized in that: B is an integer greater than 0 with B ≤ D where D = (maximum gain of the amplification stage/minimum gain of the amplification stage); and the regulation element has a regulation range subdivided into a number n of consecutive zones (11; 12) equal to the number n of the pulses of the pulse train emitted by the emitter, the first zone related to distances between emitter and receiver starting from a minimum distance possible for using the optoelectronic sensor and the n-th zone related to distances between emitter and receiver terminating with a maximum distance possible for using the optoelectronic sensor; said gain of said amplification stage being selected by selecting a point in a zone (11; 12) of said regulation range of the regulation element; said regulation range being produced in such a way that in each zone j ≠ n of the regulation range, moving a point selected within said regulation element inside the j-th zone in the direction from the starting point adjacent to the (j-1)th zone toward the endpoint adjacent to the (j+1)-th zone, the corresponding gain set up in the amplification stage is moved from the minimum gain that can be set up in the amplification stage to the minimum gain that can be set up in the amplification stage multiplied by the integer B equal to the ratio of the amplitude between two consecutive pulses in a same pulse train. ∘ a receiver arranged for receiving electromagnetic radiation, the receiver comprising a photodetector arranged for transforming the electromagnetic radiation received into a received electrical signal and an amplification stage having variable gain between a minimum gain and a maximum gain arranged for amplifying said received electrical signal; ∘ an emitter arranged for emitting a periodic electromagnetic radiation including a pulse train in each period, each pulse train including n pulses, where n ≥ 2, and wherein each jth pulse with j = 1,....,n of the train having an amplitude equal to: A j = A j − 1 * B ∘ a regulation element configured for the regulation of the gain of the amplification stage of the receiver; B is an integer greater than 0 with B ≤ D where D = (maximum gain of the amplification stage/minimum gain of the amplification stage); and the regulation element has a regulation range subdivided into a number n of consecutive zones (11; 12) equal to the number n of the pulses of the pulse train emitted by the emitter, the first zone related to distances between emitter and receiver starting from a minimum distance possible for using the optoelectronic sensor and the n-th zone related to distances between emitter and receiver terminating with a maximum distance possible for using the optoelectronic sensor; said gain of said amplification stage being selected by selecting a point in a zone (11; 12) of said regulation range of the regulation element; said regulation range being produced in such a way that in each zone j ≠ n of the regulation range, moving a point selected within said regulation element inside the j-th zone in the direction from the starting point adjacent to the (j-1)th zone toward the endpoint adjacent to the (j+1)-th zone, the corresponding gain set up in the amplification stage is moved from the minimum gain that can be set up in the amplification stage to the minimum gain that can be set up in the amplification stage multiplied by the integer B equal to the ratio of the amplitude between two consecutive pulses in a same pulse train.