Refineries are big consumers of energy and hydrogen. However, most current studies focus on the optimisation of H2 Network or Heat Integration in refineries H2 and heat are not considered together. The presented paper proposes a hierarchical targeting method for H2 and heat using the Onion Model to solve this problem. H2 networks belong to the inner layer of the onion, and heat recovery to the outer layer. The targets for H2 recovery are obtained, followed by Heat Exchanger Network targeting. A case study of an oil refinery shows that both H2 and energy can be significantly reduced. This study shows an approach to achieve a synergy of targeting H2 and heat recovery. It has great significance to the energy-saving and emission reduction of an oil refinery.