Acquisition of partially protective immunity is a dominant feature of the epidemiology of malaria among exposed individuals. The processes that determine the acquisition of immunity to clinical disease and to asymptomatic carriage of malaria parasites are poorly understood, in part because of a lack of validated immunological markers of protection. Using mathematical models, we seek to better understand the processes that determine observed epidemiological patterns. We have developed an age-structured mathematical model of malaria transmission in which acquired immunity can act in three ways (immunity functions): reducing the probability of clinical disease, speeding the clearance of parasites, and increasing tolerance to subpatent infections. Each immunity function was allowed to vary in efficacy depending on both age and malaria transmission intensity. The results were compared to age patterns of parasite prevalence and clinical disease in endemic settings in northeastern Tanzania and The Gambia. Two types of immune function were required to reproduce the epidemiological age-prevalence curves seen in the empirical data, a form of clinical immunity that reduces susceptibility to clinical disease and develops with age and exposure (with half-life of the order of five years or more) and a form of anti-parasite immunity which results in more rapid clearance of parasitaemia, is acquired later in life and is longer lasting (half-life of >20 y). The development of anti-parasite immunity better reproduced observed epidemiological patterns if it was dominated by age-dependent physiological processes rather than by the magnitude of exposure (provided some exposure occurs). Tolerance to subpatent infections was not required to explain the empirical data. The model comprising immunity to clinical disease which develops early in life and is exposure-dependent, and anti-parasite immunity which develops later in life and is not dependent on the magnitude of exposure, appears to best reproduce the pattern of parasite prevalence and clinical disease by age in different malaria transmission settings. Understanding the effector mechanisms underlying these two immune functions will assist in the design of transmission-reducing interventions against malaria.