Porosity is one of the most critical defects in additive manufacturing (AM). Although porosity formation is significantly influenced by the melt pool depth (MPD), MPD estimation and control during AM is difficult to realize. In this study, a real-time MPD estimation and control system was developed to reduce porosity formation during metal-directed energy deposition (DED). First, the width, length, height, and profile slope of the melt pool were measured using an infrared camera and a line scanner during the DED process. Thereafter, an artificial neural network (ANN) was trained and adopted to estimate the MPD in real time. A feedback control system, which adjusts the power of the printing laser, was developed to instantaneously minimize the discrepancy between the estimated MPD value and the set MPD value. The effectiveness of the proposed system for porosity reduction was validated by inspecting the printed metal components using X-ray microscopy. The porosity of the components printed with the proposed system was 81% reduced in comparison with the uncontrolled parts.