Evolutionary advantage of consciousness
DISCLAIMER

I know little on the subject. I want to first express my personal views of the existing difficulties at answering this question and then I will attempt to give a short overview of the potential answers I could find.

ISSUES WITH THE QUESTION

Consciousness vs higher cognitive abilities

I personally find it hard to disentangle evolutionary advantage of consciousness from the ones linked to other cognitive abilities especially the social ones such as for example cooperative hunting, Machiavellian intelligence or advanced communication. I think a big part of the issue in this question is in the exact definition of consciousness.

So, a very important issue with the question is that 'consciousness' is not well defined.

Only few peer-reviewd papers on the subject

While there are a number of ressources in the non-peer reviewed literature (mainly books or popular articles) on the question, I could not find a lot of papers in the peer-reviewed literature. I suppose again that part of the issue that prevents much discussion in the subject is the absent of a commonly agreed upon definition of consciousness. Some of what I'm about to quote is not peer-reviewed and some are not written by biologists but philosophers.

Evolutionary psychology remains very theoretical

One would note as well that most work in evolutionary psychology remains mostly theoretical as it is often hard to perform meaningful empirical testing for the existing hypotheses.

Quoting for safety

As I often failed to make sense of what I just read(!), I will try to quote quite  a bit to avoid misinterpreting other authors.

ANSWER

Definition of consciousness

I recommend having a look at Perlovsky (2007) for a semantic discussion (and opinion) on the concept of consciousness. Quoting their full abstract


  The knowledge instinct is a fundamental mechanism of the mind that drives evolution of higher cognitive functions. Neural modeling fields and dynamic logic describe it mathematically and relate to language, concepts, emotions, and behavior. Perception and cognition, consciousness and unconsciousness, are described, while overcoming past mathematical difficulties of modeling intelligence. The two main aspects of the knowledge instinct determining evolution are differentiation and synthesis. Differentiation proceeds from and unconscious states to more crisp and conscious, from less knowledge to more knowledge; it separates concepts from emotions, Its main mechanism is language. Synthesis strives to achieve unity and meaning of knowledge; it is necessary for resolving contradictions, concentrating will and for purposeful actions. Synthesis connects language and cognition. Its main mechanisms are emotionality of languages and the hierarchy of the mind. Differentiation and synthesis are in complex relationship of symbiosis and opposition. This Leads to complex dynamics of evolution of consciousness and languages. Its mathematical modeling predicts evolution of cultures. We discuss existing evidence and future research directions.


Consciousness as a by-product

To my personal experience, consciousness is in general viewed as a by-product of the selection for specific cognitive abilities. Again, without much of a definition of consciousness it feels to me that selection for specific social skills, such as those requiring the Theory of Mind (ToM) would yield to increase consciousness.

If consciousness and ToM (and other related cognitive skills) are the same thing, then we got our answer, otherwise, the standard view is to consider consciousness as a by-product of the selection for those higher cognitive skills.

On the topic, see for example Judd (1910) (did I really cite such an old paper?) or Dennett (1980) (Dennett is a philosopher, not a biologist).

In the comments the OP said


  To me, it feels either too complicated and inefficient or just a chance byproduct of "useful intelligence"


I would note that, if taken as an argument, then it would be a logical fallacy called argument from incredulity.

Consciousness as a result of higher social abilities

This opinion seems quite related to the previous one. Quoting from Ingold (2005)


  Becoming a person is thus a matter of gathering social relations into the structures of consciousness: the movement in development, as Vygotsky put it, is ’not from the individual to the socialized, but from the social to the individual’
  
  [..]
  
  as relationships unfold in the course of purposive social action, they are
  enfolded in the consciousness of persons, that is, in the structures of the self.
  The connection between social relations and consciousness should thus be
  understood in terms of unfolding and enfolding, rather than in terms of cause
  and effect
  
  [..]
  
  This view of sociality, and the theory of direct perception on which it is
  founded, suggests that it is possible for persons to engage with one another on
  the basis of shared perceptual experience prior to the objectification of that
  experience in terms of collective representations encoded in language and
  validated by verbal agreement. Thus sociality is possible in the absence of both
  language and the kind of objective self-consciousness that (probably) depends on language


Conscioussness as result of the logistics of decision making

Quoting from Merker (2003)


  Consciousness will be interpreted as a biological
  function evolved by mobile animals as a solution to neural logistics problems inherent in the
  control of orientation to their surroundings. The interpretation is motivated by the conspicuous
  absence from the contents of consciousness of two significant classes of information known to be
  present in brains, one on the afferent and the other on the efferent side of neural function. In fact,
  the thoroughness of their exclusion from consciousness suggests that their absence represents a
  design feature of consciousness providing important clues to its nature and biological function.
  This in turn helps constrain conceptions of its neural implementation as well as the search for its
  origin in the phylogeny of life forms