At any moment, our brains receive a stream of sensory stimuli arising from the world we interact with. Simultaneously, neural circuits are shaped by feedback signals carrying predictions about the same inputs we experience. Those feedforward and feedback inputs often do not perfectly match. Thus, our brains have the challenging task of integrating these conflicting streams of information according to their reliabilities. However, how neural circuits keep track of both the stimulus and prediction uncertainty is not well understood. Here, we propose a network model whose core is a hierarchical prediction-error circuit. We show that our network can estimate the variance of the sensory stimuli and the uncertainty of the prediction using the activity of negative and positive prediction-error neurons. In line with previous hypotheses, we demonstrate that neural circuits rely strongly on feedback predictions if the perceived stimuli are noisy and the underlying generative process, that is, the environment is stable. Moreover, we show that predictions modulate neural activity at the onset of a new stimulus, even if this sensory information is reliable. In our network, the uncertainty estimation, and, hence, how much we rely on predictions, can be influenced by perturbing the intricate interplay of different inhibitory interneurons. We, therefore, investigate the contribution of those inhibitory interneurons to the weighting of feedforward and feedback inputs. Finally, we show that our network can be linked to biased perception and unravel how stimulus and prediction uncertainty contribute to the contraction bias.