A couple of things i have learned from a golf-oriented sports psychologist:
When you are swinging well, all you should do when you are at the range is hit like 4 golf balls per club. Make sure that you have a target.
When you are working on your swing, use a 7-iron and put down an alignment club to a specific target. The alignment club should be lined up parallel left (or right if you are left handed) of your target. Take your time with each ball and make rehearsal swings with emphasis on what you are trying to work on.
As far as how many golf balls you should hit, practice for as long as you can stay focused on what you are working on. If you find yourself getting off task , either call it a day or take a little break.
I hope this helps with your practice