Even though Matt Damon and Ben Affleck insisted on keeping the movie set in Boston, many of the scenes were actually shot in Toronto, Canada. (Gasp!) For example, Harvard University usually doesn't allow films to shoot on its grounds, so many of the classroom scenes were actually shot at the University of Toronto.
Luckily, Damon and Affleck were able to make sure that the outside shots of the locations came from places that were actually in Boston. So it's really just the interiors that were shot in Canada. (Phew.)
You might not have known this, but there's also a ton of stuff in this movie that the characters just made up on the spot. For example, Sean Maguire's story about how his wife used to fart in her sleep was totally made up on the spot by Robin Williams. According to Matt Damon, you can actually see the camera bob up and down slightly at this point in the movie because the cameraman was laughing so hard (source).
On top of that, Matt Damon and Minnie Driver are said to have improvised many of their lines and their actions, which no doubt made for a pretty fun and unpredictable life on the set of this movie.