Objective The conventional single-pulse-based Brillouin optical time-domain reflectometer (BOTDR) had a low signal-to-noise ratio (SNR) in long-distance detection, limiting the sensing distance. Increasing the pulse width or peak power of a single pulse to enhance the SNR could decrease spatial resolution or induce nonlinear effects in the sensing fiber, reducing the measurement accuracy of the Brillouin frequency shift (BFS). Therefore, an effective method to extend the sensing distance without compromising spatial resolution was needed. Methods In this study, a random-sequence-based pulse code modulation scheme was adopted. The optical energy detection of BOTDR was enhanced by injecting randomly encoded pulses with varying arrays into the system. The encoding parameters were optimized to avoid nonlinear effects and extend the sensing distance. First, the time-domain distribution and self-correlation properties of random pulse sequence signals were analyzed, and the decoding principle of random pulse detection BOTDR was explained. Then, the influences of coding length and the number of coding groups on the side-lobe noise of the self-correlation function and the accuracy of the decoding results were studied by simulation. Next, a long-distance BOTDR sensor was built, and experiments were conducted using a set of random pulse codes with a peak power of 30 mW, a coding length of 640 bit, and 20 coding groups. Results and Discussions Simulations showed that increasing the coding length (L) or the number of coding groups (M) raised the peak-to-side lobe ratio (PSLR). As L and M increased, the PSLR improvement rate slowed. By optimizing the PSLR to achieve low side-lobe characteristics, a high-performance random sequence-coded BOTDR was achieved. Both L and M affected the selfcorrelation characteristics and sensor performance. Specifically, with a fixed M, increasing L caused the decoding curve to approach the single-pulse simulation curve, reducing the mean absolute error (MAE). When L-off between measurement speed and sensor performance, the optimal scheme used a coding length of 640 bit and 20 coding groups, achieving a spatial resolution of 2 m and an effective sensing distance of 81.23 km. Conclusions This study applied a random-sequence-based pulse-code modulation technique to long-distance BOTDR sensors, optimizing accuracy and sensing distance while maintaining spatial resolution. Experimental results demonstrated that using 20 coding groups of 640 bit random pulse coding with 2000 times accumulation averaging achieved an effective sensing distance of 81.23 km, a spatial resolution of 2 m, and an RMSE of ≤3 MHz. The proposed coding scheme significantly enhanced BOTDR detection distance and had broad applications in monitoring large-scale infrastructures like long-distance cables, submarine cables, and oil or gas pipelines. © 2025 Science Press. All rights reserved.