A closed-loop circulating system for drilling wells has control of the flow rates in and out of the wellbore. Kicks and fluid losses are quickly controlled by adjusting the backpressure. Kick tolerance and tripping margins are eliminated by real-time determination of pore and fracture pressure. The system can incorporate a rotating BOP and can be used with underbalanced drilling.