more details will help troubleshoot this issue better, especially since there isn't much info to go off of

i would recommend starting with the basics though,
if you're in windowed mode, make sure your not accidentally clicking off the game
make sure you're not accidentally hitting a generic windows key on your keyboard that would cause it (windows, right click keyboard key), most gaming keyboards will have keys that can disable that
if you got a special mouse, make sure you dont have any of those keys bound to those generic windows keys like i mentioned (yes, they do work in game still)
check for pop-up windows, like windows updates, or other software running updates while playing

if full screen, you will need to provide more details, since what you posted wont help much. try to add info like what operating system your on, mac running bootcamp, linux, or windows
also