While the start of Vayeshev (the start of Genesis 37) sounds as though the events all take place at one time, so that Yosef was sold (verse 28) at age seventeen (as mentioned in verse 2), it's not clear in that regard, and certainly can be read otherwise. Indeed, arguably it's less reasonable to read the verses that way, since quite a bit is mentioned in the passage: the relaying of gossip, the making of a shirt, the first dream, the second, the brothers' travel, and Yosef's.

I do know that the g'mara (M'gila 17) says he was sold at age seventeen, but commentators on Tanach often explain it differently from the way Chazal do.

Are there any Jewish commentaries that claim Yosef was sold at an age other than seventeen? What commentary, what age, and what (if any) reason does it give for saying so?

He could be at most 28, assuming he came down to Egypt, was bought by Potifar, rose to favor, was thrown in prison, and interpreted the dreams within a year before Pharaoh's birthday, after which the butler forgot him for 2 years, making him 30, consistent with the verse, when he stood before Pharaoh.
– Baby SealJan 23 '14 at 7:43