Following the work of Burger, Iozzi and Wienhard for representations, in this paper we introduce the notion of maximal measurable cocycles of a surface group. More precisely, let $mathbf{G}$ be a semisimple algebraic $mathbb{R}$-group such that $G=mathbf{G}(mathbb{R})^circ$ is of Hermitian type. If $Gamma leq L$ is a torsion-free lattice of a finite connected covering of $text{PU}(1,1)$, given a standard Borel probability $Gamma$-space $(Omega,mu_Omega)$, we introduce the notion of Toledo invariant for a measurable cocycle $sigma:Gamma times Omega rightarrow G$. The Toledo remains unchanged along $G$-cohomology classes and its absolute value is bounded by the rank of $G$. This allows to define maximal measurable cocycles. We show that the algebraic hull $mathbf{H}$ of a maximal cocycle $sigma$ is reductive and the centralizer of $H=mathbf{H}(mathbb{R})^circ$ is compact. If additionally $sigma$ admits a boundary map, then $H$ is of tube type and $sigma$ is cohomologous to a cocycle stabilizing a unique maximal tube-type subdomain. This result is analogous to the one obtained for representations. In the particular case $G=text{PU}(n,1)$ maximality is sufficient to prove that $sigma$ is cohomologous to a cocycle preserving a complex geodesic. We conclude with some remarks about boundary maps of maximal Zariski dense cocycles.