They very clearly play a role in keeping petty criminals from China, Korea, and South Asia off the streets of Japan, and it's no secret that the keisatsukan will turn a blind eye when the public interest is served. It's hard to overstate the tranquility of Japan in terms of crime. Yes, there is a rather open underworld of prostitution and that presumably includes human trafficking. But I've met gaijin girls in my language classes here who work as hostesses, and they clearly felt like they escaped from places like Indonesia and Philippines, and even in the seedy underworld here they had more opportunities than where they came from. (Anecdotal to be sure, but also first-hand.)
Also, I know restauranteurs who happily pay protection money and feel like it's a valuable service for them. Go figure.
The truly dirty business of Yakuza is moving heroin abroad--especially into the US--and that just isn't tolerated on the home front.