Wireless Sensor Network is the emerging research area due to its large number of applications such as environment monitoring, battle surveillance, health monitoring, target detection etc. WSN faces various challenges such as lifetime, fault tolerance, scalability, maintainability etc. Lifetime depends on energy wastage which can be reduced by using proper routing algorithm. In this work a routing algorithm is designed which includes the improvement of factors that affects energy of WSN nodes i.e. collision, overhearing, idle listening etc. and also the routing algorithm should be optimized by a technique known as ANT COLONY OPTIMIZATION which gives the shortest path.