Wireless sensor network is most concerning area of research now a days, energy and attacks are most challenging task for sensor network. In this paper we study about prevention and detection of sinkhole attack in sensor network techniques have some drawback too. Overcome all the problems we propose a grid based technique in which we deploy mobile agent in each grid and on the basis of acknowledgement and dely of data we compute the time and then mobile agent send the information to base station and find out the malicious behavior of node. our result shows that by using our methodology network performance enhance.