Our balancing performing a pistol squat should be no more difficult than in any other dynamic single-leg exercise. If balance is a consistent issue, it is a question of strength, mobility, or both.
Single-leg balancing requires substantial relative strength, particularly in the hip abductors and extensors (gluteus maximus, medius, and minimus)—which are frequently underrecruited relative to the other agonists (quadriceps femoris) involved in leg (knee and hip) extension. Similarly, passive tension in those muscles, as well as in the single-joint ankle plantar flexors (soleus) is frequently a limiting factor in performing a full-depth squat, even when performed with both legs. This tension only compounds existing issues with strength and control. It should be recognised that relatively few recreational athletes have the strength and mobility to perform even a deep two-legged squat safely, and a pistol squat is essentially an advanced variation of the deep squat. The solution, therefore, is to develop that strength and mobility.
As with any squat, the depth to which we perform the pistol squat should be no greater than that which allows us to maintain our centre of mass over the most stable part of our support which, with flat shoes or barefoot, is anterior to our calcaneal tuberosity (heel) but posterior to the heads of our metatarsi (forefoot). Our spine should be maintained in a neutral position throughout the movement, with the knee tracking significantly past the line of the toe. The non-weight-bearing side of the hip should be lifted so as to eliminate lateral pelvic tilt. If these elements can not be accommodated, developmental exercises—including, of course, the deep squat—should be mastered first.
It should be noted that variations in body geometry alter our ideal posture considerably. The petit frame of the woman pictured below allows her to be more upright than is typical. Men are arguably at a disadvantage in performing the pistol squat, and indeed any squat, due to their high proportional upper body mass, which demands greater joint mobility.

As a final note, if your purpose is to develop muscular strength, and not balance, why have you chosen the pistol squat? The pistol squat is innately unstable and demanding. If you are trying to circumnavigate that instability, would an alternative exercise not be more appropriate? These are philosophical questions that do not require an answer, but might serve as food for thought in your considering how to move forward with your training.
I hope that is helpful.