I have one particular thrall that wanders off all the time. If I leave him guarding my camp while off hunting when I return he is off near where I originally roped him. He is a fighter thrall and he is well cared for. His armor and weapons are the same grade as my own and I even give him some of the best food. I thought originally it was from something to do with how I was treating him. I have even named him. Nothing is working and he continues to wander off.
Welcome to the community, I am ps4 veteran player. Try the command ‘attack nothing’, maybe something spawns to the limits of his range and confuse him
. I sometimes have problem with my training thrall, if I forget to command it to attack nothing, it goes out from the door but it tries to enter from the walls 

.
Make sure he is in guard mode as opposed to scouting mode. If he is scouting, he will eventually return to the last place you told him to guard.