Don’t become mentally lazy during a thermal climb. It’s your opportunity to develop plans for the moment that climb ends. Compare every possible option, including the negatives of each. Don’t just choose the first one you think of, choose the most advantageous. Have an aggresive plan A and a conservative plan B (not the other way around). Then, when the lift weakens or dies, be decisive. MOVE! Without such foresight you’re apt to lose 500 feet or more before going anywhere, making those last few circles (or perhaps the entire thermal) a waste of precious time. However perplexed you may feel in the sometimes desperate hunt for lift, obey one cardinal rule: if you’re losing height, don’t continue to circle! Nothing is more pointless than accepting the extra sink rate (and course reversal) of a turn just to stay where there is no lift. If you have no lift and no idea where to find some, go straight in whatever direction seems a reasonable guess. This will at least maximize the distance through which you can sample the air in the endless quest for better opportunities.
When you do leave a thermal, point the aircraft exactly where you intend to go, and fly at only the appropriate speeds. Be careful to hold your wings level and not wander from the chosen course. This requires persisten focus, every single moment of every flight.