I have met this problem too. You click on an enemy, and your fleet moves into range and starts shooting. You click on the enemy again, and some ships will move closer, before they realize that they actually already are in range. This happened to me a lot (because I am quite trigger-happy), but I have learned to trust my subordinate commanders, and not ordering them to attack several times in a row. If I can behave myself and refrain from clicking on the target more than once, preferable when my fleet is far away from the target, they never go closer than they should.
I believe this behaviour is in some way caused by the command lag: You give a combined move/attack order, and the ships start moving before they have figured the exact coordinates of the target, then when they figure, they have already moved too close and get shot.