What you are experiencing is the results of your son's growing brain. He is in the process of learning how to understand cause and effect (concrete operations) and growing out of magical thinking.
It is disturbing to the inside of his own head, as things no longer seem the way they used to seem, and he is understandably getting lost fairly regularly as he learns new ways to use his growing brain. This sense of internal upset creates a lot of things: limited patience, demandingness (always a bid for more security), attitude (a result of his developing sense of personal power which is different than it was at 2)...
He will grow out of it and it helps to think of it as a natural phase (there is another, far more dramatic one that happens at around 13 that interferes with all kinds of things, creating the inability to withstand peer pressure to short-term memory problems).
Thinking of it as a phase makes it easier to stop putting him and you into warring camps. He is struggling with his new brain, just as you are struggling with the evidence of his new brain. You will find your whole life easier (now at when he's around 13) if you can see you both on the same side.
Punishment doesn't work because punishment just alienates people and makes them mad, it doesn't make them *more* inclined to do what you want them to.