Efficient allocation of limited medical resources is crucial for controlling epidemic spreading on networks. Based on the susceptible-infected-susceptible model, we solve an optimization problem as how best to allocate the limited resources so as to minimize the prevalence, providing that the curing rate of each node is positively correlated to its medical resource. By quenched meanfield theory and heterogeneous mean-field (HMF) theory, we prove that epidemic outbreak will be suppressed to the greatest extent if the curing rate of each node is directly proportional to its degree, under which the effective infection rate λ has a maximal threshold λ opt c = 1/ k where k is average degree of the underlying network. For weak infection region (λ λ opt c ), we combine a perturbation theory with Lagrange multiplier method (LMM) to derive the analytical expression of optimal allocation of the curing rates and the corresponding minimized prevalence. For general infection region (λ > λ opt c ), the high-dimensional optimization problem is converted into numerically solving low-dimensional nonlinear equations by the HMF theory and LMM. Counterintuitively, in the strong infection region the low-degree nodes should be allocated more medical resources than the high-degree nodes to minimize the prevalence. Finally, we use simulated annealing to validate the theoretical results. A challenging problem in epidemiology is how best to allocate limited resources of treatment and vaccination so that they will be most effective in suppressing or reducing outbreaks of epidemics. This problem has been a subject of intense research in statistical physics and many other disciplines [1,2]. Inspired by the percolation theory, the simplest strategy is to randomly choose a fraction of nodes to immunize. However, the random immunization is inefficient for heterogeneous networks. Later on, many more effective immunization strategies have been developed, ranging from global strategies like targeted immunization based on node degree [3] or betweenness centrality [4] to local strategies, like acquaintance immunization [5] and (bias) random walk immunization [6,7] and to some others in between [8]. Further improvements were done by graph partitioning [9] and the optimization of the susceptible size [10]. Besides the degree heterogeneity, community structure has also a major impact on disease immunity [11,12]. Recently, a message-passing approach was used to find an optimal set of nodes for immunization [13]. The immunization has been mapped onto the optimal percolation problem [14]. Based on the idea of explosive percolation, an "explosive immunization" method has been proposed [15]. However, some diseases like the common cold and influenza that can be modeled by the susceptible-infected-susceptible (SIS) model, do not confer immunity and individuals can be infected over and over again. Under the situations, one * Electronic address: chenhshf@ahu.edu.cn † Electronic address: hzhlj@ustc.edu.cn way to control the spread of the diseases is to reduce t...