Who applies censorship on an ecchi anime?
Japan does not have any rating system for normal television.
Some satellite television requires an 18+ age check to contract some channels.

DVD/BD and movies have a rating system similar to North America (G/PG12/R15+/R18+).

Most such censorship in anime is "self-censorship".
Each TV station has a different code, and the code is different for different airing time slots.
Morning anime and evening anime have more restrictions. Late night anime have less restrictions.

TV stations do not explicitly state what the code is, but the director of Bokurano wrote a blog post that says that he was asked not to show blood in the anime.

They have restrictions on blinking the screen (which can cause epileptic seizures), drinking alcohol, tobacco, violence and fanservice (ecchi) scenes.

One important group about censorship is BPO (Broadcasting Ethics &amp; Program Improvement Organization).
BPO is an organization concerned with ethics of broadcasting for all TV stations.
Sometimes, they ask TV stations to remove shows which were deemed bad for children.

Another reason is the shift in animation business models.
The old model got most of its profit from commercials.
In that time, anime production removed entire non-compliant scenes instead of adding lighting.
But recently, anime production gets more profit from DVD/BD than from commercials.
They find that broadcasting a censored version and selling an uncensored version on DVD/BD is a better strategy to increase sales.