The half brother of entertainer Dane Cook pleaded guilty yesterday to embezzling millions of dollars from the popular comedian while working as his business manager and was sentenced to serve five to six years in prison, according to prosecutors.

Darryl McCauley, 45, of Wilmington, stole the money from Cook’s business and personal accounts from 2004 to 2008 by transferring funds to his own accounts, said the office of Attorney General Martha Coakley. In one instance, he forged a $3 million check written on Cook’s account to himself.

“For several years, Mr. McCauley abused his position as a family member to gain Mr. Cook’s trust, and stole millions of dollars for his own personal gain,’’ Coakley said in a statement after the sentencing at Middlesex Superior Court in Woburn. “We hope that today’s sentence will act as a deterrent, and our office will continue to investigate and prosecute these cases.’’

McCauley’s lawyer, Robert Goldstein, was not immediately available for comment.

McCauley pleaded guilty to 27 counts of larceny over $250, three counts of forgery, embezzlement, and other charges, prosecutors said.

Superior Court Judge Mary-Lou Rup sentenced him to five to six years in state prison, during which time he will also be on probation to make sure he behaves behind bars, prosecutors said. After his release, he will have another 10 years on probation.

The 1983 Arlington High School graduate and former correction officer must also make restitution to the 38-year-old Cook and relinquish his ownership of several properties and business ventures in Massachusetts and Maine that were obtained using the stolen funds.

McCauley’s wife, Erika, also faces criminal charges, including larceny and receiving stolen property, prosecutors said. She is scheduled to appear in Middlesex Superior Court on Oct. 26 for a pretrial conference.

Darryl McCauley served as Cook’s business manager from the early 1990s to December 2008, prosecutors said. Cook and his lawyer contacted Coakley’s office that month.

Originally known as a stand-up comic, Cook has starred in movies in recent years, including “Employee of the Month,’’ with Jessica Simpson, and “My Best Friend’s Girl,’’ with Kate Hudson.

McCauley was involved in Cook’s career from the start, selling merchandise at shows and managing his e-mail list and website.

Saltzman can be reached at jsaltzman@globe.com.

© Copyright 2010 Globe Newspaper Company.