Make an action plan of the things you need to do. Something like a spiritual schedule for yourself. Make time for your salat, reading Quran, reading other books and time for reflection. Keep yourself occupied in your free time by planning out ways to reach your short term goals that you set. Inshallah this will keep you focused and productive.