The effect of the annealing treatment of a HfO2 resistive switching layer and the memory performance of a HfO2-based resistive random access memory (cross-bar structure) device were investigated. Oxygen is released from HfO2 resistive switching layers during vacuum annealing, leading to unstable resistive switching properties. This oxygen release problem can be suppressed by inserting an Al2O3 thin film, which has a lower Gibbs free energy, between the HfO2 layer and top electrode to form a Ti/Al2O3/HfO2/TiN structure. This device structure exhibited good reliability after high temperature vacuum annealing and post metal annealing (PMA) treatments. Moreover, the endurance and retention properties of the device were also improved after the PMA treatment.