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.
I instill myself with a sense that I need to accomplish this task or I will suffer severe consequences. I tell myself, "You can do it!".
I also take breaks now and then and think about things for periods of time. A good way to concentrate, relax and plan things out. Just sitting there tense won't help.
Sometimes if I can't concentrate it works to multitask. Instead of trying to focus on one thing and one thing only. I set up a few things to do and go between them.