The Premier League club announced the news on Friday evening, having opened talks with him in a bid to replace Dick Advocaat, who left his post last Sunday.
The news of Allardyce's arrival to the Stadium of Light means the Black Cats will have someone in place ahead of their trip to West Brom on October 17.
Allardyce has been on holiday in Spain as Sunderland's interest in him became an open secret, but chairman Ellis Short has persuaded him to resume his career on Wearside following his exit from West Ham after four years at the end of last season.
Short said on Sunderland's official website: "I am very pleased to welcome Sam to our football club."
Allardyce was a defender for Sunderland between 1980 and 1981, making 25 appearances, and becomes the first person to manage both the Black Cats and Newcastle.
Short added: "Sunderland is a club he knows well and he was the obvious best choice for the job. He has vast experience of managing in the Premier League and an understanding first-hand of the north east and the passion of our fans, which will stand him in great stead."
"I would like to assure our fans that once Dick made us aware of his intention to leave, Lee Congerton oversaw an organised and structured recruitment process, that bore very little resemblance to what has been described in the media.
"For example, this was a very popular job, proactively sought after by a large number of managers - contrary to much of what has been portrayed. The process was made easier by the fact that Sam was such an obvious choice.
"The other misconception is that Sam had to be persuaded to join us; nothing could be further from the truth. From the very beginning, he understood the importance of this job and showed great enthusiasm for the role and a desire to be part of moving this club forward."
Allardyce took charge of the Magpies in May 2007, following eight largely successful seasons with Bolton, although he lasted only eight months on Tyneside, with fans distinctly unsatisfied with the team's style of play.