Five million pounds is to be spent improving the quality of bathing water on the Teesside coast.