Controller disconnects

Hi, I have a problem that controller stop working after 5 minutes, I thought it was a controller problem and I bought a new one that actually worked fine for few weeks but than the same problem appeared! I need to disconnect the usb from the controller and plug it again and than press the ps button to make it sync or if the usb cable is not connected I need to use the reset button on the controller. any ideas?