A complete ensemble empirical mode decomposition with adaptive noise (CEEMDAN) thresholding denoising method optimized by non-local means (NLM) algorithm is proposed in this paper. First, in order to enhance the adaptability and the accuracy of the algorithm, a composite screening method based on sample entropy and probability density Mahalanobis distance for intrinsic mode functions is proposed. According to the proposed screening method, the intrinsic mode functions are divided into three levels. Secondly, in order to obtain a threshold which can be adaptively changed, a threshold evaluation criterion is proposed to assist in selecting a suitable threshold. Then, the optimized thresholding denoising algorithm by the non-local means are introduced to denoise the intrinsic mode functions of different levels, in which the non-local means algorithm with different parameters is used to smooth the different intrinsic mode functions. Finally, all intrinsic mode functions are reconstructed to obtain the denoised signal. The results of numerical simulation and experimental analysis to Doppler, Bumps, Signal3 (randomly generated non-standard test signal) signals, partial discharge (PD) signals and real signals show that the method of this paper improves shortcomings of the traditional thresholding denoising method, such as inaccurate threshold selection, discontinuity of the data points of the denoised signals, and that the structure of the denoised signal is easily destroyed and the useful small amplitude part of the denoised signal is easily discarded. The algorithm has better adaptability.