JAMES GANDOLFINI’s death was a wake-up call for his “Sopranos” co-star and good friend Lorraine Bracco, who has since dropped 35 pounds fearing she’d meet the same tragic fate as her heavyweight pal.

The 59-year-old “Rizzoli & Isles” actress’ weight shot up to 183 pounds a few years ago while she was caring for her ailing, elderly parents. But after Gandolfini died of a heart attack last June at the age of 51, Lorraine realized she needed to make drastic changes to her lifestyle, says an insider.

“Lorraine was a wreck after James’ death,” the insider divulged. “She could barely muster the energy to get out of bed. Like many of his friends, she felt intense guilt for not needling him to take better care of himself.

“But then Lorraine realized she was headed down the same deadly path. After seeing James’ life snuffed out too early, she vowed to take better care of herself.”

The actress, who played Tony Soprano’s psychiatrist, Dr. Jennifer Melfi, on the HBO mob series, cut out almost all sugar, dairy and gluten from her diet and hired a life coach to help her avoid emotional eating, says the insider. She also goes to the gym regularly and practices daily meditation.

“Lorraine only wishes she would have started getting healthy earlier,” the insider continued. “Then maybe she could have helped James get on the diet bandwagon too.”

The 6-foot-1 actor’s weight had ballooned to nearly 300 pounds before he died during a vacation in Rome, Italy. As The ENQUIRER reported, a doctor had warned him not long before his death to stop drinking and to go on a strict diet. Sadly, Gandolfini did not heed that advice.

Lorraine, however, has a new lease on life and plans to release a diet and self-help book, “To the Fullest,” next year.

“Lorraine adored James,” the insider added. “She decided the best way to honor his memory was to get healthy.”