Known for his comedic roles on CBS's How I Met Your Mother and NBC's Freaks and Geeks, he won a Chicago Critics Lifetime Achievement Award in 2011. He's played memorable roles in such films as Knocked Up, The Five-Year Engagement, Forgetting Sarah Marshall and 2011's The Muppets. He also voiced the character Victor "Vector" Perkins in Despicable Me.
He wrote the screenplay of his hit film, Forgetting Sarah Marshall, partially based off of his own experiences. He also won a Critics Choice Award for Best Song for "Life's a Happy Song," which is featured in The Muppets.
He had an uncredited role as Brice in the 2011 film, Friends With Benefits, which featured his former co-star, Mila Kunis.
He grew up near Malibu, California, and began his acting career on the cult classic television series, Freaks and Geeks, in 1999.
He dated actress Michelle Williams from 2012 to 2013.