Often my jaw will locks itself and afterwards it clicks. How can I stop the locking and clicking?

Have it evaluated. See a dentist who has experience and training treating patients with tmd (temporomandibular joint dysfunction). There are many conservative methods to help deal with this issue.