You live in a wonderful time to be an 'out' introvert (even if you're not, really).
In some settings, it's traditionally been very difficult to get people to understand that you're truly wired differently than others. Even in my lifetime, it was more frequently assumed that I was shy and needed experience rather than it being a different personality type that would never actively enjoy those activities.
This is a conversation I have frequently, and over the years, it's become easier and easier. It does need to be tailored to your situation but here's what I usually start with:
Hey, I really appreciate that you want me to go out with you, but I have to be honest. I'm pretty introverted and these types of activities are mentally draining to me. Rather than getting to unwind at the end of the day, which these do for you, it actually leaves me even more tired and drained.
It means a lot to me that you want to include me and keep inviting me, but understand that this is something I can't keep doing twice a week. These types of night out are more like a once a month thing for me.
Even if you aren't truly an introvert, this answer has become more and more acceptable as people have learned that this isn't a social skill you just haven't developed.
Take a test to figure out where you fit on the scale. Knowing will help you approach others, and if this is a new revelation for you, it will give you a lot of reading material on how to approach situations you don't get anything out of.
EDIT:
For reference, I've been the Executive Vice President of a software development company and I've been asked to speak at NADA and other industry conferences around the world.
I don't want to get too much into a discussion about what introversion is and isn't, but it can have very little, or at great deal, of impact on your career. It's a common belief that introverts are all shy and socially awkward. It's true that plenty of us end up that way because they don't enjoy those interactions, so they either fear them, or never develop them.
That doesn't have to be the case, and it's entirely possible to be an excellent asset to your company without going out and drinking several nights a week. I could (and have) make a strong argument that you're more of an asset for not doing that.
However, if you do get challenged on it, you have a couple of options. First, try and redirect the venue to something you'd enjoy more. Look for a code jam nearby and encourage everyone to go. When they don't want to, give them a hard time (and be merciless about it). Tell them that they invite you all the time to the bar, and you begrudgingly go, and this is more your speed and you expect them to return the favor. If that's not their scene, they'll quickly come around.
Unfortunately, if you work in a very specific (albeit rare) environment where after hours activities truly are a requirement for the job and there's a glass ceiling to anyone who doesn't participate, you might have to move on. I can assure you though, that isn't the norm (speaking with both US and UK experience.)