As a boulder climber, you need to get up close and quite personal with the wall you are climbing to have a successful answer to the problems at hand. Some of the best advice you can get is keep your body close to the wall. You should also keep your center of gravity balanced in a forward-backward direction, not leaning on one side or the other too heavily. In other words, keep your weight focused toward the wall or away from the wall. Understandably, sometimes leaning back away from the wall is necessary to see the route. There is no set distance because of the variety of types of moves, hand holds in climbing, height of the climber, and reach distance. In most cases, the more accurate you need to be with your balance the closer to the wall your body and face should be- think about Spider-Man!
A good indicator to be aware of is the direction your knees point. In general, in a good climbing technique the knees do not point directly in towards the wall, and your body posture is rarely erect. The more erect, and the more your knees point into the wall the further your center of gravity will be out away from the wall. Some climbers tend to climb a little more erect to take advantage of their height. Experiment with different stances and distances so you can adjust and adapt to the conditions. Making small adjustments can help to increase your move efficiency and the key is to keep it like Spidey and close to the rock!