Hamlet was sane. He was brilliant with his ability to use his interpersonal and intrapersonal intelligences. This indicates that he was extremely aware of himself and everyone around him, thus making him responsible for his actions. The following are quotes from the play that demonstrate Hamlet's use of these skills and prove his sanity.
Interpersonal Intelligence (discerning people for who they really are):
Hamlet - Then I would that you were so honest a man. (Act 2, Scene 2, line 177)
Hamlet - Do you think I am easier to be played on than a pipe? (Act 3, scene 2, line 341)
Hamlet - You go not till I set you up a glass where you may see the inmost part of you. (Act 3, scene 4, line 20)
Hamlet - He keeps them, like an ape, in the corner of his jaw, first mouthed to be last swallowed. When he needs what you have gleaned it is but squeezing you and, sponge, you shall be dry again. (Act 4, scene 2, line 17)
Intrapersonal Intelligence (internal reflection):
Hamlet - "Seems," madam? Nay it is. I know not "seems."(Act 1, Scene 2 line 76)
Hamlet - For there is nothing either good or bad, but thinking makes it so. (Act 2 scene 2, line 246)
Hamlet - What a piece of work is a man! How noble in reason, how infinite in faculty! (Act 2, Scene 2, line 299)
Hamlet - To be, or not to be? That is the question (Act 3, scene 1, line 56)
Gertrude - O'er whom his very madness, like some ore among a mineral of metals base, shows itself pure. He weeps for what is done. (Act 4, scene 1, line 25)
Hamlet - What is a man if his chief good and market of his time be but to sleep and feed? A beast, no more. (Act 4, scene 4, line 32)