Injection of anthropogenic carbon dioxide (CO2) into geological formations is a promising approach to reduce greenhouse gas emissions into the atmosphere. Predicting the amount of CO2 that can be captured and its long term storage stability in subsurface requires a fundamental understanding of multiphase displacement phenomena at the pore scale. In this paper, the lattice Boltzmann method is employed to simulate the immiscible displacement of a wetting fluid by a non-wetting one in two microfluidic flow cells, one with a homogeneous pore network and the other with a randomly heterogeneous pore network. We have identified three different displacement patterns, namely stable displacement, capillary fingering and viscous fingering, all of which are strongly dependent upon the capillary number (Ca), viscosity ratio (M), and the media heterogeneity. The non-wetting fluid saturation (Snw) is found to increase nearly linearly with log Cafor each constant M. Increasing M (viscosity ratio of non-wetting fluid to wetting fluid) or decreasing the media heterogeneity can enhance the stability of the displacement process, resulting in an increase in Snw. In either pore network, the specific interfacial length is linearly proportional to Snw during drainage with equal proportionality constant for all cases excluding those revealing considerable viscous fingering. Our numerical results confirm the previous experimental finding that the steady state specific interfacial length exhibits a linear dependence on Snw for either favorable (M≥1) or unfavorable (M<1) displacement, and the slope is slightly higher for the unfavorable displacement.