the main thing to keep gains consistent is constantly mixing up your routine. I never do the same workout 2 weeks in a row. I keep what days I hit each muscle the same (sometimes, it often varies slightly from week to week), but I vary the exercises, reps, rest time, volume, etc... each worout. Even something like if you usually work chest first then shoulders second, next week work shoulders first and chest second.
Your body adapts very quickly to handle whatever you tell it to, so changing any part of your workout will force it to try to adapt to a different type of stimulation. Which, in short, means GAINS or fat loss in some cases.
Another issue could have been your diet. Maybe after 12 weeks of dieting your metabolism slowed from being used to not getting enough calories to maintain weight. Pretty much it adapted to the amount off food you were giving it and found a way to maintain itself with that amount of fuel. In a case like this calorie cycling or carb cycling is often used to trick your body into burning more calories and using carbs more efficiently. Basically on a day when you are more active you would take in more calories or carbs then you would on rest days, or else you would have one reload day per week. These are ways to jump start your metabolism, so to speak.
Hope I helped, feel free to ask any questions you may have!