The Br2 and Cl2 interaction with the intrinsic, and Co-doped graphyne nanosheets has been explored by density functional theory calculations. Two vertical and parallel configurations were identified for Br2 and Cl2 adsorption. Calculations showed that the adsorption of Br2 was stronger than Cl2 on the graphyne nanosheet. Neither Br2 nor Cl2 could make serious changes to the HOMO-LUMO gap (Eg) and electrical resistance pf pristine sheet. By manipulating the structure of pristine graphyne by Co atom, its reactivity and sensitivity dramatically improved toward Br2 and Cl2 gases. Compared to the Cl2, the Br2 much more decreases the electrical resistance and Eg of the Co-doped graphyne (~ -40.25%). Thus, the Co-doped graphyne may selectively recognize the Br2 gas in the presence of Cl2. The computed recovery time value for Br2 from the surface of the Co-doped graphyne is 36.4 s, which shows that the graphyne, as a sensor, benefits from a short recovery time to detect Br2.