One thing that DEFINETELY helped me keep my focus is scoring my drills (I created a spreadsheet) and planning them *before* I get to the table. Also, the best way to avoid frustration for me is to correct whatever mistake I make immediately. These days, I miss a shot I should make during practice, you can bet a won't leave the poolhall until I can make it 10 in a row. I also practice the mental side by:
1)never letting my eyes leave the table;
2)never allowing myself to complain or get discouraged when I make a mistake;
My practice has improved 100% because of these changes, and it's actually more enjoyable as well.
P.S. Another problem I used to have focusing was trying to work on too many things in one practice session. These days I always do no more than three: warm up/fundamentals drills; whatever weakness I might be working on; and a playing drill (the ghost, Q-Skills, etc.). That way I'm able to go for at least 3 hours w/o a wane in my focus.