Paul Erdos suggested the following problem: Determine or estimate the number of maximal triangle-free graphs on n vertices. Here we show that the number of maximal triangle-free graphs is at most 2(n2)/(8+o(n2)), which matches the previously known lower bound. Our proof uses among others the Ruzsa-Szemeredi triangle-removal lemma, and recent results on characterizing of the structure of independent sets in hypergraphs.