Personally, I can not concentrate for more then 1-2 hours on something.
No matter what I do I just can't concentrate, I tried music but that just made my concentration worse. This is really annoying, especially when I need to do a whole lot of work in 3 hours.
For homework? I learned that chewing mint gum(or something else minty) releases a chemical in your brain and makes you more alert. And sudies show students working in natural sunlight had 25% better grades than those that didn't. I know it will help with concentration; but there're some good homework tips.
Drink enough, fresh air, sunlight. Take a break and setting a goal ist quite good. I do something like "after 90 min of work I am allowed to make a short game or listen to my favored music or have a piece of choclate
Nice thing is, no one can truly concentrate on something for more than 2 straight hours; that is the reason why coffee break exist (or the pauses between hours at school).