Use that when the meaning of the sentence is affected (or even ruined) if the information after that is left out.
- I was wearing the pants that I brought to the party
- He held out the hand that was hurt.
Use which when the sentence still makes sense if the information after which is left out.
- An index would have made it easier to steer through the book, which also lacks a map.