  We develop a sheaf cohomology theory of algebraic varieties over an
algebraically closed non-trivially valued non-archimedean field $K$ based on
Hrushovski-Loeser's stable completion. In parallel, we develop a sheaf
cohomology of definable subsets in o-minimal expansions of the tropical
semi-group $\Gamma_\infty$, where $\Gamma$ denotes the value group of $K$. For
quasi-projective varieties, both cohomologies are strongly related by a
deformation retraction of the stable completion homeomorphic to a definable
subset of $\Gamma_\infty$. In both contexts, we show that the corresponding
cohomology theory satisfies the Eilenberg-Steenrod axioms, finiteness and
invariance, and we provide natural bounds of cohomological dimension in each
case. As an application, we show that there are finitely many isomorphism types
of cohomology groups in definable families. Moreover, due to the strong
relation between the stable completion of an algebraic variety and its
analytification in the sense of V. Berkovich, we recover and extend results on
the topological cohomology of the analytification of algebraic varieties
concerning finiteness and invariance.
