Ok, so it sounds like you actually have two problems.
- How do you deal with the little things
- When do you expand
I'm going to address the second one first.
Don't expand if you're still dealing with harassment and large armies. Expanding is very much BW style play and largely is designed around the concept: Expand when I have Map Control. If you don't have Map Control and you try to expand, what's going to happen is that your opponent is going to shut you down with some small task force (like 12 Reapers or 8 Muta). You're going to respond with your whole army and he's going to pull away with little or no losses. So if you're losing expansions to harassment, chances are you just don't have the map control to expand.
Next you talk about how you're losing larger armies (40% to micro). Almost everything your army does requires 0 attention from you, except combat. If you're engaging in a situation where you will lose (split army) your response should be retreat to somewhere you can win. If this means sacrificing an expansion, sacrifice it. If you're walking into an unscouted position, retreat. Scouting is a far more valuable use of your time in these situations than micro is.
Now, if you're losing because your Zealots are in the back and your Stalkers aren't blinking, and you're running into storms, then the problem you're really having is how you macro. You should be building and organizing your units as part of your macro. If you're building your Zealots behind your Stalkers and leaving them there, that is bad macro.
Finally, if you are engaging a scouted opponent and thinking that you should win, then give over most of your attention to this battle. Perhaps build things via hot keys only, but don't move your screen for more than a second. Big battles require a lot of attention, and you should give it to them.
You also mentioned harassment in a couple of contexts so let me give you some good advice. Photon cannons are not designed to stop harassment, they're designed to delay it. It is far better that his Mutalisks spend the time to kill 2 photon cannons, than you build the 8 photon cannons to stop this raid. Use defensive structures as a delaying tactic.