We perform molecular dynamics simulation study of CO, methane, and their mixture in the presence of brine over a broad range of temperature (311-473 K), pressure (up to about 100 MPa), and NaCl concentration (up to about 14 wt %). The general decrease in the interfacial tension (IFT) values of the CH-brine system with pressure and temperature is similar to that obtained for the corresponding CH-water system. The IFT of methane and brine is a linearly increasing function of salt concentration, and the resulting slopes are dependent on the pressure. A similar behavior as methane is observed for such systems containing CO and CO-CH mixture. The IFT of CO and brine increases linearly with increasing salt content; however, the resulting slopes are independent of pressure. The simulations show that the presence of CO decreases the IFT values of the CH-water and CH-brine systems, but the degree of reduction depends on the amount of CO in each sample, which is consistent with experimental evidence. These IFT values show a linear correlation with the amount of CO, and the resulting slopes are dependent on the temperature and pressure. Furthermore, our results for the mole fractions of the different species in the CO-CH-water system at 323 K and 9 MPa are in agreement with those of experiments. The mole fractions of methane and CO in the water-rich phase decrease with increasing salt concentration, whereas that of HO in the methane- or CO-rich phases remains almost unaffected in all of the studied cases. Our results could be useful because of the importance of carbon dioxide sequestration and shale gas production.