The gate electrodes 94 are deposited over the gate dielectric layers 92, respectively, and fill the remaining portions of the recesses 90. The gate electrodes 94 may be a metal-containing material such as TiN, TaN, TaC, Co, Ru, Al, combinations thereof, or multi-layers thereof. For example, each of the gate electrodes 94 may include a diffusion barrier layer (not illustrated separately), a work function layer 97 over the diffusion barrier layer, and a fill metal 98 over the work function layer 97. The diffusion barrier layer may be formed of titanium nitride (TiN), which may (or may not) be doped with silicon. The work function layer 97 determines the work function of the gate, and includes at least one layer, or a plurality of layers formed of different materials. The material of the work-function layer is selected according to whether the respective FinFET is an n-type FinFET or a p-type FinFET. For example, when the FinFET is an n-type FinFET, the work-function layer may include a TaN layer and a titanium aluminum (TiAl) layer over the TaN layer. When the FinFET is a p-type FinFET, the work-function layer may include a TaN layer, a TiN layer over the TaN layer, and a TiAl layer over the TiN layer. The material of the work function layer 97 is chosen to tune its work function value so that a target threshold voltage Vt is achieved in the device formed, in some embodiments. After the work function layer 97 is formed, the fill metal 98, which may include any suitable conductive material such as W, Co, Cu, Al, or the like, is formed over the work function layer 97 to fill the recess 90.