Block-matching and 3D filtering algorithm (BM3D) is the current state-of-the-art for image denoising. This algorithm has a high capacity to achieve better noise removal results as compared with other existing algorithms. Nevertheless, there is still much room for improvement in this algorithm to achieve more attractive results. To address the shortcomings of BM3D filtering, our paper algorithm makes the following contributions: Firstly, the traditional hard-thresholding of the BM3D method is substituted by an adaptive filtering technique. This technique has a high capacity to acclimate and change according to the noise intensity. More accurately, in the proposed algorithm, soft-thresholding is applied to the high-noise areas, whereas the total variation filter is applied to the light-noise areas. The self-adaptation and stability of the proposed adaptive filtering technique have enabled this technique to achieve optimal noise reduction performance and preserve the high spatial frequency detail (e.g. sharp edges). Secondly, since too small threshold leaves the most amount of the noise without removing, in contrast, a too large threshold fails to maintain the significant information of the image such as edges. Accordingly, in our proposed algorithm, applying the adaptive filtering function in the first stage is based on an adaptive threshold. This threshold is adaptable and changeable according to the amount of the noise. Thirdly, an Adaptive Weight Function (AWF) that depends on the spatial distance between the reference patch and its candidate patches, is adopted in the proposed dissimilarity measurement. When the distance between the reference patch and the candidate patch is small enough (nearby patches), AWF adopts the proposed dissimilarity measurement in computing this distance. On the other hand, when the distance between the reference patch and the candidate patch is large enough (where the candidate patches are located out of the region of the reference patch), AWF adopts the k-means clustering and the Formula (21) in computing this distance. The k-means clustering is adopted at the last estimate. Utilizing the k-means clustering to partition the image into several regions and identify the boundaries between these regions obliges the block matching to search within the region of the reference patch, which leads to reducing the risk of finding poor matching. Our proposed filter is tested on various digital images for different filtering quality measures. This filter shows significant improvements over BM3D filtering in terms of visual quality, Peak Signal-to-Noise Ratio (PSNR) index, and Structural Similarity (SSIM) index.