Efforts at elimination of scourges, such as malaria, are limited by the logistic challenges of reaching large rural populations and ensuring patient adherence to adequate pharmacologic treatment. We have developed an oral, ultra–long-acting capsule that dissolves in the stomach and deploys a star-shaped dosage form that releases drug while assuming a geometry that prevents passage through the pylorus yet allows passage of food, enabling prolonged gastric residence. This gastric-resident, drug delivery dosage form releases small-molecule drugs for days to weeks and potentially longer. Upon dissolution of the macrostructure, the components can safely pass through the gastrointestinal tract. Clinical, radiographic, and endoscopic evaluation of a swine large-animal model that received these dosage forms showed no evidence of gastrointestinal obstruction or mucosal injury. We generated long-acting formulations for controlled release of ivermectin, a drug that targets malaria-transmitting mosquitoes, in the gastric environment and incorporated these into our dosage form, which then delivered a sustained therapeutic dose of ivermectin for up to 14 days in our swine model. Further, by using mathematical models of malaria transmission that incorporate the lethal effect of ivermectin against malaria-transmitting mosquitoes, we demonstrated that this system will boost the efficacy of mass drug administration toward malaria elimination goals. Encapsulated, gastric-resident dosage forms for ultra–long-acting drug delivery have the potential to revolutionize treatment options for malaria and other diseases that affect large populations around the globe for which treatment adherence is essential for efficacy.