I'll second and supplement a suggestion of Carl's. When I lose focus on the field, it is often fatigue made worse by dehydration.
It seems a little thing, but staying hydrated actually makes a significant difference to your vision, your attention, and your mood. It doesn't solve bad habits, but if you're fundamentally sound it can help you get back on track, especially in late innings.
It's also easier to manage than releasing your inner Stalin...