The increase of the elongational viscosity of recycled poly(ethylene terephthalate) (PET) is investigated with the aim of producing closed-cell foams by means of a cost-effective reactive extrusion technique. A recycled PET grade containing controlled contamination levels of polyvinyl chloride (PVC) and poylethylene (PE) is selected, and compared with virgin bottle-grade PET as a reference. Reactive processing with a tetrafunctional epoxy additive induces randomly branched molecules with a lower degree of branching in recycled PET than in virgin PET, as shown by a molecular structure analysis. The corresponding increase in elongational viscosity is related to foaming experiments performed using supercritical CO2 in a pressurized vessel. Observations of foam microstructures reveal that modified virgin PET forms closed-cell structures under a large variety of foaming conditions, as opposed to unmodified virgin and recycled PET, which collapse as a result of insufficient elongational resistance. Closed-cell foams are also obtained using modified recycled PET, providing that the temperature at which the pressure is released is lowered to 260°C. Recycling of PET into closed-cell foams is thus achieved, although the processing window is slightly reduced compared to virgin PET.