We present three-dimensional direct numerical simulation (DNS) results of a horizontal flexible pipe conveying two-phase incompressible flow at moderate Reynolds numbers (400 ∼ 700). We find that the Reynolds number (Re) and the void fraction (α) essentially determine the onset of self-sustained oscillations in the two-fluid/pipe system. We employ a phase-field formulation to solve the Navier-Stokes coupled with the Cahn-Hilliard equation and the structure equation in an arbitrary Lagrangian Eulerian (ALE) framework. A spectral/hp element method is adopted for the fluid solver and a Galerkin method for the structure solver. We construct stability diagrams showing the transitions between different states of the two-fluid/pipe system. Specifically, we focus on the transition from a stable state to a planar oscillatory state and also to an out-of-plane oscillatory state as a function of four non-dimensional parameters, the Reynolds number Re, the void fraction α, the fluid-tension parameter Ip, and the averaged flow velocity U. By comparing simulation results with those for a pipe conveying single-phase flow under similar conditions, we find that the two-fluid/pipe system loses stability at a lower Reynolds number. We also find that, under similar Re,Ip, and U, at values of void fraction α∈0.6∼0.8, corresponding to the slug/churn flow regimes, the pipe experiences the largest vibrations, which is consistent with previous experimental and theoretical studies. We also perform a spectral analysis and identify the different excited modes, which are found to vary depending on the values of the void fraction α.