Here, a porous cobalt–organic framework with pillared layer structures, namely [Co3OBA3PTD(H2O)2⋅ 2 DMA⋅H2O]n (1, H2OBA=4,4′‐oxybis(benzoic acid); PTD=6‐(pyridin‐4‐yl)‐1,3,5‐triazine‐2,4‐diamine), was fabricated by using cobalt trinuclear nodes, low‐cost carboxylic linker, and accessible nitrogen heterocyclic ligands. This compound exhibited a highly efficient solvatochromism towards CH2Cl2 within one minute and can be used 200 times at least. The corresponding dropper detector was assembled as a practical sensor. Meanwhile, the porous Co3O4 was obtained by a simple but effective annealing treatment. Electrochemical measurements confirm that this Co3O4 material derived from compound 1 shows high and stable lithium storage capabilities (1081.75 mA h g−1 at 200 mA g−1 after 115 cycles) and excellent rate properties.