well, I may not be in the right position to give you advise since I've never failed any courses. But I'll give you my share of how to motivate myself in my studies.
For me, I just get up and go. What I mean is that when I feel I need studying, I just go study. If you feel you need to work harder, then work harder! There is no substitute for hard work. If you feel you are tired, burnt out... take a 10 minutes break, take a 30 minutes nap (with alarm clock set) or take a shower. Remember to time yourself however, so that when you are done taking a break, get up and go again! Even when you are doing well in class, you STILL should study. Do some extra problems, get a different book on the same material, discuss problems with friends, or in the physics forums. The reason why smart people always seem to have an extra edge is mostly because they dedicate more time than anyone else in the class. When I was in my classical mechanics class, most people did poorly in the final exam, but for me, I got an A. Why? because even though I was doing well in that class, I did (almost) every single problem in the book. So when an extra difficult exam is out, I can still handle it. I don't claim to be particularly bright or anything, but one thing I can say is that I definitely can work harder than anyone else in my class.
To be honest, to do well in physics, you just have to be willing to put in the extra work and effort. For me, studying are often very enjoyable and satisfying, so that it doesn't feel as much of a burden. If you can't put in the extra work or studying just do not interest you so much, then maybe you should re-evaluate your career path (please don't take this as offensive). Whatever your major is, you should enjoy learning it.