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 grew up near Malibu, California and began his acting career on the cult classic television series Freaks and Geeks in 1999.
He based the screenplay of Forgetting Sarah Marshall partially on his own experiences. He won a Critics Choice Award for Best Song for "Life's a Happy Song," which is featured in The Muppets.
He dated Actress Michelle Williams from 2012 to 2013. He then began dating Alexis Mixter.
He had an uncredited role as Brice in the 2011 film Friends with Benefits, which featured his former co-star Mila Kunis.