We give bounds for the Betti numbers of projective algebraic varieties in terms of their classes (degrees of dual varieties of successive hyperplane sections). We also give bounds for classes in terms of ramification volumes (mixed ramification degrees), sectional genus and, eventually, in terms of dimension, codimension and degree. For varieties whose degree is large with respect to codimension, we give sharp bounds for the above invariants and classify the varieties on the boundary, thus obtaining a generalization of Castelnuovo’s theory for curves to varieties of higher dimension.