The best season to visit Tanzania is during the long dry season, which falls from July to September. These are considered the best months for safaris, the Great Migration, trekking, and beach holidays in Zanzibar.
Of course, these months are peak travel season. They will be busier, and some lodges, hotels, and parks will apply higher rates.
If you prefer a more secluded experience, consider visiting during the short rainy season from the end of October to December.
If possible, you'll want to avoid visiting during the long rainy season in April and May. The rains are often heavy and sudden, which can result in activities being cancelled at the last minute.