The development of adsorbents for extracting gold from solutions is desirable from an environmental and economical point of view. Here, the authors report two two-dimensional silver(I)‒organic frameworks that enable selective sensing and extraction of gold from aqueous solutions, including seawater and solutions of e-waste.