2 added 109 characters in body

The quick reply is: not really for $i \gt 2$, and not in the way you perhaps expect for $i=2$, see below.

The comment on Charles' answer about 'teaching you never to ask that question again' is partly true, partly not. The lesson to learn from Giraud is that really one does not use groups for coefficients of higher cohomology. For a start, Giraud's $H^2(X,G)$ is not functorial with respect to group homomorphisms $G\to H$! One also does not get the exact sequences that one expects (this is due to the lack of functoriality). But this is not a problem with his definition of the cohomology set, but a problem with what category you believe the coefficients lie in. This is because the coefficient object of Giraud's cohomology is actually the crossed module $AUT(G) = (G \to Aut(G))$, and the assignment $G \mapsto AUT(G)$ is not functorial. (Aside: Giraud contains lots of other important things on stacks and gerbes and sites and so on, so the book is not a waste of time by any means)

But little-known work by Debremaeker[1-3] from the 1970s fixed this up and showed that really the Giraud cohomology was functorial with respect to morphisms of crossed modules. This has been recently extended by Aldrovandi and Noohi [4] by showing that it is functorial with respect to weak maps of crossed modules aka butterflies/papillion.

It was realised by John E. Roberts (no relation) and Ross Street that the most general nonabelian cohomology has as coefficient objects higher categories. In fact, we now know that the coefficients of $n^{th}$ degree cohomology is an $n$-category (usually an $n$-groupoid, though), even when we are talking about usual abelian cohomology.

Everything I've talked about is just for groups etc in Set, but it can all be done internal to a topos, i.e. for sheaves of groups, and more generally a Barr-exact category (and probably weaker, but Barr-exact means that the monadic description of cohomology therein due to Duskin (probably going back to Beck) works fine).

[1] R. Debremaeker, Cohomologie a valeurs dans un faisceau de groupes croises sur un site. I, Acad. Roy. Belg. Bull. Cl. Sci. (5), 63, (1977), 758 -- 764.

[2] R. Debremaeker, Cohomologie a valeurs dans un faisceau de groupes croises sur un site. II, Acad. Roy. Belg. Bull. Cl. Sci. (5), 63, (1977), 765 -- 772.

[3] R. Debremaeker, Non abelian cohomology, Bull. Soc. Math. Belg., 29, (1977), 57 -- 72.

[4] E. Aldrovandi and B. Noohi, Butterflies I: Morphisms of 2-group stacks, Advances in Mathematics, 221, (2009), 687 -- 773.

1

The comment on Charles' answer about 'teaching you never to ask that question again' is partly true, partly not. The lesson to learn from Giraud is that really one does not use groups for coefficients of higher cohomology. For a start, Giraud's $H^2(X,G)$ is not functorial with respect to group homomorphisms $G\to H$! One also does not get the exact sequences that one expects (this is due to the lack of functoriality). But this is not a problem with his definition of the cohomology set, but a problem with what category you believe the coefficients lie in. This is because the coefficient object of Giraud's cohomology is actually the crossed module $AUT(G) = (G \to Aut(G))$, and the assignment $G \mapsto AUT(G)$ is not functorial. (Aside: Giraud contains lots of other important things on stacks and gerbes and sites and so on, so the book is not a waste of time by any means)

But little-known work by Debremaeker[1-3] from the 1970s fixed this up and showed that really the Giraud cohomology was functorial with respect to morphisms of crossed modules. This has been recently extended by Aldrovandi and Noohi [4] by showing that it is functorial with respect to weak maps of crossed modules aka butterflies/papillion.

It was realised by John E. Roberts (no relation) and Ross Street that the most general nonabelian cohomology has as coefficient objects higher categories. In fact, we now know that the coefficients of $n^{th}$ degree cohomology is an $n$-category (usually an $n$-groupoid, though), even when we are talking about usual abelian cohomology.

Everything I've talked about is just for groups etc in Set, but it can all be done internal to a topos, i.e. for sheaves of groups, and more generally a Barr-exact category (and probably weaker, but Barr-exact means that the monadic description of cohomology therein due to Duskin (probably going back to Beck) works fine).

[1] R. Debremaeker, Cohomologie a valeurs dans un faisceau de groupes croises sur un site. I, Acad. Roy. Belg. Bull. Cl. Sci. (5), 63, (1977), 758 -- 764.

[2] R. Debremaeker, Cohomologie a valeurs dans un faisceau de groupes croises sur un site. II, Acad. Roy. Belg. Bull. Cl. Sci. (5), 63, (1977), 765 -- 772.

[3] R. Debremaeker, Non abelian cohomology, Bull. Soc. Math. Belg., 29, (1977), 57 -- 72.

[4] E. Aldrovandi and B. Noohi, Butterflies I: Morphisms of 2-group stacks, Advances in Mathematics, 221, (2009), 687 -- 773.