Sonic X ran for a total of three seasons. The anime followed Sonic and his friends after they were transported to the human world, and it wrapped up its story across those three arcs.
If you're looking to watch the whole adventure from beginning to end, those three seasons have you fully covered.