In the scene where Sean starts talking about his dead wife and her farting antics the lines were ad-libbed by Robin Williams, which is why Matt Damon is laughing so hard. The scene took everyone by surprise. According to Damon in the DVD commentary, this caused the cameraman to laugh so hard that the camera can be seen moving up and down slightly.
“Most days I wish I’d never met you ‘cause then I could sleep at night. I didn’t have to walk around with the knowledge that there was someone like you out there. I didn’t have to watch you throw it all away.”