Environmental factors restrict malaria parasite development, but the influence of host metabolic variations on the infectivity of the blood stage parasite is not fully understood. Here we show that mice on a ketogenic diet are completely protected from infection with the malaria parasite Plasmodium berghei. We further show that administration of the ketone body β-hydroxybutyrate (βOHB), but not of acetoacetate, increases survival of infected mice and inhibits proliferation of both P. berghei and Plasmodium falciparum in vitro. Administration of either a ketogenic diet or βOHB induces metabolic reprogramming in parasites, including reduced levels of nicotinamide adenine dinucleotide, which is associated with the downregulation of genes controlling parasite development, erythrocyte invasion and pathogenicity. Our data indicate that a ketogenic diet and the ketone body βOHB confer resistance to malaria in mice by causing developmental arrest of Plasmodium parasites, highlighting the potential of dietary and metabolic strategies to fight malarial infection.