Attack with a clear goal and withdraw when that goal isn't possible
Today I played a PvT. I secured myself a quick lead by engaging his army when it was vulnerable, and expanding safely and more quickly than him. From there, I continued to out-expand him and was in a seriously huge economic lead.
However, I suddenly hit the 200/200 mark, after playing defensively, not wanting to engage his tanks, and fending off his attempted drops. I went for an attack on his one expansion (his natural), thinking the longer I wait, the more time I waste being supply capped. Although I killed his army with feedbacks, storms, and good positioning, I also lost my entire army. Why? His natural was a planetary fortress, backed up by tanks, missile turrets, and a bio ball. Although my method of engagement was flawless, his defensive position was too strong for an all-in.
The mistake I made was a good lesson: Attack with a clear goal and withdraw when that goal isn't possible.
If you are in the lead, remember that what's keeping you safe is your superior army. If you waste that, even if you have the income to replace it, you might not be able to replace it fast enough, and the enemy could actually turn the game around on you.
This is why Zerg end-game armies are sometimes thrown away by high level players in a seemingly inefficient manner: he can replace it almost instantaneously, after doing significant damage to the enemy T or P army. Then he can push again with another 200/200 army to secure the victory, while the enemy is 100 supply short from the last engagement.
At this point in the game, I was securing the last two expansions on the map and my income was insane, I could rebuild a 200/200 army in no time.
What I should have done, however, was destroy his army, psi-storm his SCV line, and immediately withdraw, so as to not lose unnecessary army to his fortress. Then, after re-building my army (perhaps adding in some void rays to help with the fortress), attack again to finish the job.
It's obvious that you shouldn't suicide attack a superior enemy force. However, it's also important to remember not to attack an inferior force if you're going to take unnecessarily large losses. Or, if you do engage, to have a clear goal and plan of withdrawal, so you don't find yourself with 6 stalkers impotently shooting at a planetary fortress.
It's always okay to sit back on your lead, surround the enemy, and contain him until he's out of the game, even after you've hit 200/200. You can always just tech up more, upgrade more, and build more production facilities to reproduce your army faster, after you do engage, and secure the victory.
Alternatively, if you know you can rebuild your army significantly more quickly than he can, you can engage with your army, do as much damage to his as possible, and rebuild yours instantly for a second attack to do real infrastructural damage.