Molecular electronics has proven to extend physical limit of Moore’s law since molecules are the main operators in electronic circuitry. We investigated high-performance nanoelectronics employing molecular junctions made of porphyrin, its metal-doped equivalent, and graphene electrodes using first-principles calculations. Theoretically, it has also been investigated if it is possible to sense gases by utilizing the transport characteristics of the linking system. Target gas molecules were analyzed for adsorption energy, charge density, and gas molecule recovery time. Our simulation shows that the adsorption of NH3, SO2, NO2, and H2O gas molecules has a major impact on the electronic transport properties of the porphyrin devices. The Co-porphyrin device is a better choice for a reusable sensor based on the less recovery time for NO2 and SO2 gases in the visible optical range at room temperature. The device made of co-doped porphyrin is more sensitive to SO2 gas molecules than other molecules and exhibits superior sensitivity to other 2-D materials. These results show that each of our devices can detect these gases, suggesting a low-power, ultrasensitive, recyclable, room-temperature gas sensor. This work uses nonequilibrium Green’s function (NEGF) formalism and density functional theory (DFT) for the computation.