Interest in gene therapy medicines is intensifying as the first wave of gene-correcting drugs is now reaching patient populations. However, efficacy and safety concerns, laborious manufacturing protocols, and the high cost of the therapeutics are still significant barriers in gene therapy. Here we describe liquid foam as a vehicle for gene delivery. We demonstrate that embedding gene therapy vectors (nonviral or viral) in a methylcellulose/xanthan gum-based foam formulation substantially boosts gene transfection efficiencies in situ, compared to liquid-based gene delivery. We further establish that our gene therapy foam is nontoxic and retained at the intended target tissue, thus minimizing both systemic exposure and targeting of irrelevant cell types. The foam can be applied locally or injected to fill body cavities so the vector is uniformly dispersed over a large surface area. Our technology may provide a safe, facile and broadly applicable option in a variety of clinical settings.