A common challenge for Bayesian models of perceptual behavior is the fact that the two fundamental components of a Bayesian model, the prior distribution and the likelihood function, are formally unconstrained. Here we argue that a neural system that emulates Bayesian inference naturally imposes constraints by the way sensory information is represented in populations of neurons. More specifically, we show how an efficient coding principle can constrain both the likelihood and the prior based on the underlying stimulus distribution. We apply this idea to the perception of visual orientation and formulate an encoding-decoding model based on a prior distribution that reflects the statistics of visual orientations in natural scenes. At the behavioral level, our model predicts that perceived orientations are biased away from the cardinal orientations where the prior distribution peaks. Such biases are seemingly at odds with the traditional Bayesian view that the prior always biases a percept towards the prior peaks. Yet they are in perfect agreement with recent studies that report perceptual biases toward the oblique orientations. Our model also correctly predicts the reported relative biases toward the cardinal orientation when comparing the perceived orientation of a stimulus with low versus a stimulus with high external noise. The model is able to account for both types of biases because it assumes an efficient neural representation that typically generates asymmetric likelihoods with heavier tails away from the prior peaks. At the neurophysiological level, the proposed efficient coding principle predicts neural tuning characteristics that match many aspects of the known orientation tuning properties of neurons in primary visual cortex. Our results suggest that efficient coding provides a promising constraint for Bayesian models of perceptual inference, and might explain perceptual behaviors that are otherwise difficult to reconcile with traditional Bayesian approaches.