A gastro-retentive drug delivery system for controlled release of drugs in the stomach or upper gastro-intestinal track provides one or more polymers that hydrate and swell to immobilize the drug in situ in a protective, degradable envelope or cocoon. In one embodiment, oppositely charged polyelectroytes are admixed with the drug and filled in a capsule having a dissolution profile in stomach acid at body temperature. The dissolution profile of the capsule promotes formation of a poyelectrolyte gel complex. The gel complex increases retention time of the drug and reduces dosing requirements, increases absorption, reduces dose-dependent side effects, and provides reproducible, time-controlled drug residence in the GI tract.