The Lexington Democrat said in a statement Tuesday that he plans to remain in the Senate and will seek re-election in the fall.
Barrett says he received the diagnosis Monday and expects to remain at Massachusetts General Hospital for about a month.
After that, he must still avoid crowded places, including the Statehouse, for a period of time because his condition leaves him highly susceptible to infection.
Barrett says he'll continue to get legislative work done using a laptop, cellphone and email.
The 69-year-old returned for a second stint in the Senate in 2013. He also served in the chamber from 1987 to 1994.
This version corrects the dates of Barrett's first stint in the Senate to 1987 to 1994.
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.