Estimation of Distribution Algorithms (EDAs) still suffer from the drawback of premature convergence for solving the optimization problems with irregular and complex multimodal landscapes. In this paper, we propose an adaptive niching EDA based on Affinity Propagation (AP) clustering analysis. The AP clustering is used to adaptively partition the niches and mine searching information from the evolution process. The obtained information is successfully utilized to improve the EDA performance by a balance niching searching strategy. Two different categories of optimization problems are used to evaluate the proposed adaptive niching EDA. The first is the continuous EDA based on single Gaussian probabilistic model to solve two benchmark functional multimodal optimization problems. The second is a real complicated discrete EDA optimization problem, the protein 3-D HP model based on k-order Markov probabilistic model. The experiment studies demonstrate that the proposed adaptive niching EDA is an efficient method.