Ted tries to bond with The Captain in this scene. It's from the episode "The Mermaid Theory."
Ted has a good reason to look scared in this scene. Kyle MacLachlan's The Captain is up to something goofy.

How I Met Your Mother Season 6 Episode 11 Quotes

Lily: Anytime a single guy hangs out with a married woman there are rules that must be followed. Rule number one...
Barney: Don't use the husband's condoms, that's just rude.

Robin: Hey Captain, quick question. What do you think about the Jonas Brothers?
Marshall [covering the right half of the Captain's face]: He hates that he loves them.