The governance of sulfur dioxide emissions in the atmosphere is a global challenge. Herein, a three-dimensional ultramicroporous porous organic framework named TAM-POF with high surface areas, abundant accessible N sites and suitable pore size was synthesized for elimination of SO2 in flue gases and aromatic sulfides in liquid fuels. The adsorption and separation performance of TAM-POF is investigated by equilibrium gas adsorption, instant adsorption rates and column breakthrough experiments. A record-high SO2 dynamic adsorption capacity of 2.92 mmol g−1 in ternary gas mixture (0.5/10/89.5, v/v/v, SO2/CO2/N2) and SO2/CO2 (124) and 3-methylthiophene/n-octane (42) selectivities were achieved in TAM-POF. The strong interaction between adsorbents and TAM-POF, as well as appropriate pore apertures are the main reason for their excellent desulfurization performance, which are also evidenced by theory simulation.