We present a theoretical prediction of a highly efficient membrane for hydrogen purification and natural gas upgrading, i.e. laminar MoS material with triangular sulfur-edged nanopores. We calculated from first principles the diffusion barriers of H and CO across monolayer MoS to be, respectively, 0.07 eV and 0.17 eV, which are low enough to warrant their great permeability. The permeance values for H and CO far exceed the industrially accepted standard. Meanwhile, such a porous MoS membrane shows excellent selectivity in terms of H/CO, H/N, H/CH, and CO/CH separation (>10, > 10, > 10, and > 10, respectively) at room temperature. We expect that the findings in this work will expedite theoretical or experimental exploration on gas separation membranes based on transition metal dichalcogenides.