no matter what diet you are one, to lose weight you need to be in a caloric defecit, and to gain weight you need to have a surplus. so pick one and stick to it.
In addition, insulin is one of the most powerful anabolic hormones in your body. this makes it very benefical to take advantage of while trying to gain size.
You spike insulin levels with carbs and being the main purpose of keto is "no carb" in order to controll insulin levels, keto is definitly not optimal for size gain.