Considering weather, prices, and crowds, the best times to visit the Yucatán Peninsula [1] are from late November to mid-December, and from mid-January to early May. You’ll avoid the intense heat from June to August, the rain (and possible hurricanes) in September and October, and the crowds and high prices around Christmas.
The big caveats with those periods are spring break (March/April) and Semana Santa (the week before Easter), when American and Canadian students, and then Mexican tourists, turn out in force and prices spike temporarily.
Be aware that certain attractions are only available (or recommendable) during specific months, whether snorkeling with whale sharks [2] (June–September) or visiting Chichén Itzá [3] on the spring equinox.
Even many year-round activities like sportfishing, kiteboarding, and bird-watching are better or worse according to the season.
Links:
[1] http://www.moon.com/destinations/cancun-the-yucatan
[2] http://www.moon.com/destinations/cancun-the-yucatan/cancun-cozumel-and-the-riviera-maya/cancun/isla-holbox/sights/whale-shark-feeding-grounds
[3] http://www.moon.com/destinations/cancun-the-yucatan/the-state-yucatan/chichen-itza-and-piste/chichen-itza-archaeological-zone