The Vale of Glamorgan, Cardiff and Bridgend Councils are working in partnership on the development of a reed bed filtration facility.
As a by product, clean water will be produced and be available for use for gully cleansing, while soil and other solid waste materials will be also be recycled.
The£160,000 project will be monitored by the Environment Agency.
Cabinet member for visible services Rob Curtis said: 'This is an excellent example of how councils can work together.'
Cardiff Council executive member for environment and transport Elgan Morgan said: 'The technology is tried and tested and is a very effective and sustainable solution to this problem.'
Bridgend Council cabinet member for environment Matthew Voisey said: 'This is a classic example of what can be achieved with joint working.'
Vale operational manager Keith Jones said: 'Currently, the waste from gullies is taken to landfill. This new treatment facility is a long-term approach to dealing with the waste and will provide an excellent sustainable solution to our problems.
'We have been concerned for some time about the long-term viability of taking this waste to landfill, and are very pleased with this solution.'
Housing, planning & environment