Structural fabrication and modification are the effective approaches to regulate the electrochemical performances of anatase TiO2. Herein, the template-annealing-etching processes are carried out to synthesize inverse opal TiO2 with N-doped carbon layer and oxygen vacancies surface as an anode material for advanced lithium ion batteries and sodium ion batteries. These structural features not only shorten the diffusion paths and enhance the electronic conductivity, but also induce the dominant pseudocapacitive contribution. As a result, the as-prepared electrode exhibits the excellent Li+/Na+ storage performances, including a high capacity retention (462 mAh g−1 after 300 cycles at 0.5 A g−1) and a fast cycling capability (180 mAh g−1 after 3500 cycles under 10 A g−1) for lithium storage; a reversible capacity of 140 mAh g−1 after 400 cycles under 1 A g−1 for sodium storage. Revealed by cyclic voltammetry, the pseudocapacitive contribution is as high as 74.49% and 73.38% at 1 mV s−1 for lithium ion batteries and sodium ion batteries, respectively. This work may promise a general approach to synthesize metal oxides anode materials for advanced energy storage devices.