Hello:
It sounds like he may think he is imitating you, or he sees it as attention.
I found that when my son got riled up enough, he'd just go overbard with the screams, or the tantrum, or the snarky remarks...and one day a light went off in my brain. I looked at him and in a calm voice said, "Do you need a hug?"
So, I hugged him, calmed him down, and then addressed the problem calmly. He still wasn't happy, but he was more willing to engage.
When kids reach a certain point, little will get through to them. If you cannot engage them, your efforts will be for naught. Some people use shock thereapy to engage their kids (corporal punishment, soap in the mouth, grounding for a time greater than the age set can comprehend), others calm the situation and then deal with the issues.
I prefer the second method because it encourages thinking for both parent and child. You child is young, some concepts may yet me beyond his development. On the otherhand, it is no excuse to let him get away with things...he does have to learn.
But ask yourself a couple of questions:
What is the source of his behavior; is he tired, is he screaming for attention he thinks he isn't getting?
When he is having time out and is being snarky; are the things you are saying to him even getting though? Is he engaged?
When he's being snarky, you can say "You are welcome to your opinions, but this time it isn't going to change [enter specific circumstance here]." Then turn and walk away. Sticks and Stones may break the bones, but words may never harm ye. ;)
Try to assess the reasons behind it, not just the behavior and you may be able to nip the behavior in the bud before it becomes a big nasty weed.
Good luck...it is a hard age to be in, and a hard age to care for...but it can also be a lot of fun for both!