Spin-orbit torques (SOTs) and the perpendicular magnetic anisotropy (PMA) in Ta/W/CoFeB/MgO structures have been investigated by varying the thickness of the W layer. Addition of the W layer gives rise to enhancement of the annealing stability and perpendicular anisotropy field. After annealing at high temperature, a high-resistivity is obtained for samples with W layer (up to 2 nm thickness), which indicates the existence of β-W phase. A giant spin Hall angle of 0.50 is found in Ta/W/CoFeB/MgO structures with a 2 nm W layer by using the harmonic Hall voltage measurement. The lowest switching current density of 6 MA/cm2 is achieved in the sample with 1 nm W layer, indicating that a strong interfacial spin Hall effect may exist in the CoFeB/W interface. The study may provide a way to obtain simultaneously a large PMA as well as a high efficiency of SOTs.