An apparatus and method are disclosed for treating overweight and obese patients by applying a restrictive Artificial Gastric Valve (AGV) on part of the stomach. The apparatus includes a mechanism to control the opening of the AGV automatically on demand, dynamically and progressively. The controlled opening of the AGV inside the stomach controls and regulates the flow of food.