The longer answer is:
1. You state that even higher management are your friends. Just how good? Visit each other on weekends? Hang out in bars? Or just "treat you in a friendly manner in the office"?
1.a. If it's the last, they are not true friends and you shouldn't give this "friendship" any weight whatsoever.
1.b. If they really are good friends, tell them about the offer. A 7k raise and 40 minutes shorter commute are not trivial to pass up. If they care about you, they might actually advise you to take it, even if it hurts them temporarily.
2. A 7k rise is a lot. If another company is willing to pay you such a hefty raise, you've been working for many years now at wages below what you could/should have been making. Why is the difference so large?
2.a. If it's because you've passed up opportunities to get a raise, either by leaving or declining a promotion at your current company, you are of course to blame.
2.b. If however as I suspect you simply haven't received (proper) pay raises at your current company for several years, thus putting you behind the curve, they have in effect been screwing you over. And make no mistakes, companies know *exactly* how much the going rate is for each programmer grade and seniority. So if they have been knowingly screwing you out of proper wages for several years, they are certainly no friends of yours.