It depends on what you want.
If you love long and warm summer evenings, go for June. If you love swimming in the ocean, go for September. The sea is not warmed up in June, especially im the Northern Mediterranean. But the sunset in September is a real downside because it can be between 7 and 8 PM depending on your location.
Also note while it can be very nice and mild until October, the weather begins to change at around September to a more unstable state. For example, we have cruised in the Western part (Spain-France-Italy) with Harmany of the Seas in the first week of September 2016. We were not allowed on deck half of our cruise! The weather was mostly sunny, but windy and waves at around 10 feet. The brand-new Harmony even suffered from some damages on the top deck. That said, you would be likely safe if you went to Greece, Turkey or Israel at that time.