Lanthanide metal–organic frameworks (Ln-MOFs) have attracted extensive attention because of their structural adjustability and wide optical function applications. However, MOFs with a wide linear pH response and stable framework structures in acidic or alkaline solutions are rare to date. Here, we used 4,4′,4″-s-triazine-2,4,6-triyltribenzoate (H3TATB) as an organic ligand, coordinated with lanthanide ions (Eu3+/Tb3+), and synthesized a new metal–organic framework material. The material has a porous three-dimensional square framework structure and emits bright red or green fluorescence under 365 nm UV light. The carboxyl group of the ligand is prone to protonation in an acidic environment, and negatively charged OH− and ligand (TATB3−) have a competitive effect in an alkaline environment, which could affect the coordination ability of ligand. The luminescence degree of the framework decreases with the increase in the degree of acid and base. In particular, such fluorescence changes have a wide linear response (pH = 0–14), which can be used as a potential fluorescence sensing material for pH detection.