The rules governing these two words are a bit flexible, but "which" is too often used where "that" should be. "That" is preferable when you are limiting or restricting a noun:
The following line from a nursery rhyme is instructive here, because all of the "thats" are correct:
In contrast, "which" introduces a phrase that provides descriptive yet incidental information, and "which" often requires commas on one or both ends of the phrase it introduces:
In short, you use "that" to complete a noun and "which" simply to describe a noun.
Self-Study
Want more on :"that" vs "which"? Check out these entertaining websites:
"Which vs That" article from the worldwidewords.org
James Thurber's advice on why we should "Never monkey with Which"