We investigate quantifier alternation hierarchies in first-order logic on finite words. Levels in these hierarchies are defined by counting the number of quantifier alternations in formulas. We prove that one can decide membership of a regular language in the levels BΣ 2 (finite boolean combinations of formulas having only one alternation) and Σ 3 (formulas having only two alternations and beginning with an existential block). Our proofs work by considering a deeper problem, called separation, which, once solved for lower levels, allows us to solve membership for higher levels.A:3 to be decidable. The class BΣ 1 (<) consists exactly of all piecewise testable languages, i.e., such that membership of a word only depends on its scattered subwords up to a fixed size. These languages were characterized by Simon [1975] as those whose syntactic monoid is J-trivial. A decidable characterization of Σ 2 (<)-hence of ∆ 2 (<) as well-was obtained by Arfi [1987;, a problem revisited and clarified by Pin and Weil [1995;, who also set up a generic algebraic framework to work with. For ∆ 2 (<), the literature is very rich, see the survey by Tesson and Thérien [2002]. For example, the ∆ 2 (<) definable languages are exactly the ones definable in the two-variable restriction of FO(<) [Thérien and Wilke 1998]. These are also the languages whose syntactic monoid belongs to the class DA, as shown again by Pin and Weil [1995; (see also [Schützenberger 1976]). For higher levels in the hierarchy, getting decidable characterizations remained a major open problem. In particular, the case of BΣ 2 (<) has a very abundant history and a series of combinatorial, logical, and algebraic conjectures have been proposed over the years. We refer to Section 3 and to several surveys cited in this section for a bibliography. So far, the only known effective result was partial, working only when the alphabet is of size 2 [Straubing 1988].Contributions.. In this paper, we establish decidable characterizations for the fragments BΣ 2 (<), ∆ 3 (<) and Σ 3 (<) of first-order logic. These new results are based on a deeper decision problem than membership: the separation problem. Fix a class C of languages. The C-separation problem amounts to deciding whether, given two input regular languages, there exists a third language in C containing the first language while being disjoint from the second one. Solving the C-separation problem is more general than obtaining a decidable characterization for the class C. Indeed, since regular languages are effectively closed under complement, testing membership in C can be achieved by testing whether the input is C-separable from its complement. While this reduction immediately transfers decision procedures for one problem to the other, this is not our primary motivation for looking at separation. Although intrinsically more challenging, a solution to the separation problem requires more understanding than just getting a decidable characterization. This understanding for a given fragment can then be exploited in order to ob...