Get one’s mind out of the gutter

To stop having inappropriate thoughts.

I wish that my friend would get his mind out of the gutter.