A gastroretentive drug formulation for the sustained releaseof an active agent in the gastrointestinal tract comprises an internal layeror compartment comprising an active agent and one or more pharmaceuticalexcipients, of which at least one is a polymer and two membranesforming together an envelope around the inner membrane, each membranecomprising at least one polymeric combination of an enteric polymerwhich is not soluble in gastric juice, and an hydrophilic swelling polymer,and at least one plasticizer.