How I Met Your Mother star Jason Segel is looking a lot slimmer these days. 

He was seen leaving a building in Boston on Oct. 16 and from the looks of it he has pretty much transformed. He told Us Weekly about his lifestyle change on July 30.

"I've just been living healthy, exercising, eating right -- no more midnight pizzas. This time when I take my shirt off, I've made a promise to myself, it doesn't have to be funny...I took heat for Forgetting Sarah Marshall, where I was completely nude. But different characters require different body types."

The actor is in Boston filming his next film Sex Tape, also starring Cameron Diaz, and previously said he was planning to shed a few pounds for his upcoming role.

"It's R-rated...and I'm not in shape for no reason," teased Segel.

The movie follows a couple who is desperately searching for a lost adult film they made of themselves. It is scheduled to hit theaters next summer.

In the meantime, fans can catch Segel on the small screen for the ninth and last season of How I Met Your Mother. He told the magazine how he feels about the popular show coming to an end. 

"My favorite moments have just been watching my cast mates grow up. We have been together for a decade now and a lot of life stuff has gone on for everybody. It's like a real family. It's the longest I've known any group of people besides my family."

How I Met Your Mother airs Monday nights on CBS at 8/7c.

Tags: Jason Segel