The 38-year-old, who has been out of management since leaving Vicarage Road last November, replaces Lambert after he quit to take over at Norwich last month.
Boothroyd led the Hornets to the Premier League in 2006 before they were relegated after one season in the top flight.
He also took them to the 2007 FA Cup semi-finals but left by mutual consent after a poor start to the last Championship campaign.
Boothroyd was in the stands as the U's lost on penalties at Gillingham in the Johnstone's Paint Trophy on Tuesday night.
He takes over at the Community Stadium with Colchester handily placed in fifth after their good start under Lambert, including the infamous 7-1 opening-day win at Norwich which led to the sacking of Bryan Gunn.