Internal-tamponade agents are crucial surgical adjuncts in vitreoretinal surgery. Clinically used endotamponade agents act through buoyancy forces, yet can result in prolonged post-operative positioning, temporary loss of vision, raised intra-ocular pressure, cataract formation or the need for additional removal surgery. Here, we describe a thermogelling polymer that provides an internal tamponade effect through surface tension and swelling counter-forces. We tested the long-term biocompatibility of the polymer endotamponade in rabbit vitrectomy models, and its surgical efficacy and biocompatibility in a non-human primate retinal-detachment model. We also show that, while the thermogel biodegrades during the three months following surgery, it promotes the reformation of a vitreous-like body that mimics the biophysical properties of the natural vitreous. The thermogelling endotamponade might serve as a long-term vitreous substitute.