The usual and best remedy for this is in the past....read only those books that you are interested in i.e do not take up studies which you are not interested in and most of the times, this helps.
But if your studies are in the field that you are interested in (which differs from the field that you may have chosen for a variety number of other reasons) and still this is affecting you, then you need to find out why you are thinking of so many other things
this could be due to social problems (like not having enough money to feed the family whilst spending time instead of earning a livelihood) which could/could not be helped by you
due to psychological problems (lack of attention is a common feature in many of the mental health problems like depression
So, finally it will be upto you to decide what is the cause of you lack of focus and act accordingly.
help to increase focus and concentration so you may try them.