Bobolinko's advice is correct and the best course of action.
But to answer your specific question about the phoen being hacked...No, wiping it won't help. Neither will installing a different ROM or anything else.
If what your buddy is saying is actually happening, it's most likely not that someone have hacked into your phone and is remotely sending messages from your phone. It's far more likely that someone intercepted your cell signal, hacked the IMEI number (as stated above) and applied your IMEI number to another device, thus cloning your phone.
That message to your buddy came from another device entirely and never went through your phone at all. The problem is that this is very hard to fix. You can't have T Mobile jus tblock your IMEI number because then your phone won't work either. T Mobile can't distinguish between your phone and the cloned fake phone because both are broadcasting the same IMEI number, which is the identifier T Mobile uses to use your phone.
Have you left the United States recently and used your phone in another county? This whole scenario is vey common in Russia and other Eastern European countries. People got there on a vaction, use their phone, and immediately the phone's IMEI is captured and stolen. If you had mobile data turned on or used wifi, the user data on the phone is also likely compromised. Meaning all passwords, etc.
If you haven't left the US, it's much less likely, but still possible this is what happened.
Someone could have also physically looked at your phone, wrote down the IMEI number under the battery, and cloned it that way just to screw with you. No intercepted radio signals or anything. Just good old fashioned "copying the key". In that scenario it's almost certainly someone you know (unless you are in the habit of leaving your phone completely unattended around strangers).