This also sounds like I was when I was in middle school. How old are you? Because if you are young, it's not so bad, you'll probably learn to fit in more as you get older. You can try a version of 'lurk more' in real life to a certain extent, if that helps.
Don't take jokes too harsh, learn to roll with them. If you take jokes personally every time someone fries you, you're just setting yourself up for more. You also said something about having a lot of book smarts, so I take it you are pretty good in classes. I'm not going to tell you to stop that, but if you are aggravatingly smart, people won't take kindly to that. I don't know if you do this, but if you always try to answer all the questions the teachers ask, or tell stupid and unfunny jokes, it won't help your popularity, either.
Or, if your problem is more that you don't understand jokes, you can try using
urbandictionary.com, which is basically a dictionary of slang and stuff. A lot of the main stuff is just internet crap, but if you know what you're looking for, you can probably find it.
I don't have a whole lot of information with which to help you, so I can just give you a few bits of good advice that I've picked up over the years. My best advice that I can think of is to find your niche, maybe pick up a few quirks that set you apart, and learn from what happens to you.
ps don't tell everyone that you complained about your life on a pokemon forum