Development of efficient and reliable thermoelectric generators is vital for the sustainable utilization of energy, yet interfacial losses and failures between the thermoelectric materials and the electrodes pose a significant obstacle. Existing approaches typically rely on thermodynamic equilibrium to obtain effective interfacial barrier layers, which underestimates the critical factors of interfacial reaction and diffusion kinetics. Here, we develop a desirable barrier layer by leveraging the distinct chemical reaction activities and diffusion behaviors during sintering and operation. Titanium foil is identified as a suitable barrier layer for Mg3Sb2-based thermoelectric materials due to the creation of a highly reactive ternary MgTiSb metastable phase during sintering, which then transforms to stable binary Ti-Sb alloys during operation. Additionally, titanium foil is advantageous due to its dense structure, affordability, and ease of manufacturing. The interfacial contact resistivity reaches below 5 μΩ·cm2, resulting in a Mg3Sb2-based module efficiency of up to 11% at a temperature difference of 440 K, which exceeds that of most state-of-the-art medium-temperature thermoelectric modules. Furthermore, the robust Ti foil/Mg3(Sb,Bi)2 joints endow Mg3Sb2-based single-legs as well as modules with negligible degradation over long-term thermal cycles, thereby paving the way for efficient and sustainable waste heat recovery applications.