H2, N2, CO, and CO2 are readily incorporated in the porous, 3D sodalitic frameworks of coordination polymers of the [ML2]n type, with M = Pd(II) or Cu(II) and HL = 2-hydroxypyrimidine or 4-hydroxypyrimidine. The metal ion and ligand functionalization modulate their sorption properties, making these materials suitable for gas storage and separation purposes.