The experienced Senegal international will join up with former manager Allardyce after his contract expires at the Britannia Stadium on 30 June.
Faye is expected to be joined by several other signings as the Hammers look to climb out of the Championship at the first attempt.
Faye enjoyed a successful career in English football with Bolton Wanderers and Newcastle United - where he worked under Allardyce - before moving to Stoke in August 2008.
The defender made his name in French football with RC Lens and FC Istres before being brought to Bolton - initially on loan - by Allardyce in July 2005.
The 33-year-old spent two seasons at the Reebok Stadium, appearing in the UEFA Cup and making more than 70 appearances for the Trotters under Big Sam.