I have a 4 year old, very smart Shetland sheepdog. He has never had any kind of formal training like obedience school or a dog trainer, but he is generally very well behaved when he is inside. He has learned to sit, stay, come, get on and off the bed, etc on command. He also understands "no," and that when I say, "that's enough" or "no more" that he is not in trouble but needs to stop what he's doing. But when he is outside, he doesn't obey at all. He will mostly just bark and run around, and if you approach him he usually just runs off. He also refuses to come inside when we want him to. He decides when to come in. We can't tempt him inside with food because he is just too smart. He knows what we're up to and will not approach food unless we put it down and back off. Also, in order to get to the garage, you must go through the backyard. When we try to leave, he runs around in circles and barks, and we cannot control him or make him stop. He has actually killed a section of grass doing this. My dad tried putting up a small fence in the middle of his route, which worked for a while, but now he just runs around it. Obviously, he is much faster than us, so that we cannot catch him when he is outside. I think he has figured this out, and that is the reason he does not behave. What can we do to get him to behave outside.
See it from his perspective
Outside is this amazing space full of lots of wonderful smells, sights and sounds. There are other creatures there: in the ground, in the trees, or that have left their scent in passing. It's full of stimulation.
Inside is nice and warm and cosy, but to him it's basically a boring place where all there is to do is sleep. Unlike us, he can't read a book, or get meaningful stimulation from the computer/television/whatever you're doing, nor even have a nice chat on the phone/with whomever is around. It'd be like you being trapped in your bedroom.
Consequently, when you coax him back inside, to him it's the end of fun time and the start of a long stint of boring time. Of course he's going to ignore you if he can, and stay out there for as long as possible. Even better, sometimes you accidentally reward his stubbornness with every dog's most favourite game, chase!
By far and away the best solution to this is to give your dog plenty more stimulation and outdoor exercise: I don't have an especially active breed (certainly a lot less active than a Sheltie), but she gets at least two hours of walks (not just time alone outside) every day—most of that involving lots of play with balls and other dogs, but all of it involving interaction with people.
Changing that perspective
If that's not possible, what's the solution? Make inside more appealing to him! Try to stimulate him inside whenever possible: I've bought some "doggie puzzles", though it's easy enough just to hide some treats or a toy (show him what you're doing at first) and get him to "find it!". I even play hide and seek with my dog from time to time (I tell her to stay, then I go hide somewhere and call for her to come: she gets treats and lots of praise when she finds me, which further strengthens her recall when we're outside), or just work on some tricks (heel, come, roll over, etc)—we'll then carry on practising those when we're outside (but only after she's had some exercise). All of this is designed to stop inside being seen as a purely boring place, but rather somewhere that fun happens too.
I use little training treats, but if your dog isn't food-motivated, then reward the desired behaviour with some stimulation. 5 minutes of play, for example. Dogs love nothing more than a bit of interaction.
Training him to come inside on command
I suggest going outside with a squeaky toy (or whatever he loves) and engaging him in play. After a short while, end the play and go back inside. Once he's lost interest in you, go back outside and do it again.
Repeat until he shows great interest in you whenever you appear at the door. Now produce the toy but don't play outside... instead throw it inside for him. If he wants to take it outside, that's fine. Don't stop him. Keep playing. You don't want him to equate the toy being inside with either the end of play or his access to outside. So just carry on playing with him wherever he wants. He'll stop seeing the door as a gateway between sleep and fun.
Once you've done this a number of times, and he's clearly relaxed about coming in to fetch the toy and even staying inside to play with you for a bit, then add a command. "Inside!" as you throw the toy inside. Repeat a few more times.
Now you're ready to just show him the toy and say "inside!" without throwing it. He should come bounding in. If not, go back a step or two and try again. Training is all about repetition.
Once he comes inside, then you can reward him with praise and a little play with the toy. Soon enough you'll be able to say "inside!" without any toy (but hey, keep up the praise!).
First of all: to your dog "sit" while in your house is very different from "sit" while outside. So, him not beign able to follow the same commands in different locations is annoying, but perfectly normal.
The key will be to train the same command outside as well, as if you do it for the very first time, and your dog has no idea what "sit" even means.
First would be: NO off-leash time outside. You can take a very long leash for outside playtime, but Off-leash is out until he obeys.
Second: find something he WILL pay attention to. An awesome treat, a special toy, some game he really likes.
Then, as I said, start training outside as if he knew nothing. Most important is a way to get his attention. When you can get it, reward absolutley EVERY behavior you would like the dog to show.
One thing to keep in mind in case all else fails: Your dog will not starve is he doesn't get food for a day. You may want to check with your vet, but if you can approach this by only feeding the dog when he comes in when you call. You set out food, call him, and he doesn't come? Fine, food goes away.
Keep in mind this will onyl work if the dog will NOT resort to huntign mice or anything like this, and DO make sure he does not truly starve.
I think eggyal and Layna did a very good job in covering the subject. I do have things to add from my personal experience, though.
As eggyal was saying, you're dog is seeing the outside as fun time and the inside as dull. The doggy puzzles and other stimulus are a good idea, but it'll never be as stimulating as the outdoors. It's like if someone took you to an amusement park and after 15min, they said alright, I'll give you $5 if you leave. You didn't say if your dog is food motivated (most are, but I have one that really isn't very food motivated), but that's how your dog feels about it. Whatever treat you have isn't as good as more outside time.
I've noticed this a lot with house dogs. My two dogs do come inside if they weather is bad, but mostly they're outside on the porch. We live in the country, so they aren't fenced in or tied up. They could run away to California if they wanted, but they hardly ever get off the porch. Conversely, when my grandmother would take her house dog to the river or when my aunt does the same, their dogs run away and won't come to them. My aunt often runs after her Pomeranian yelling "Sit, sit, sit, sit..." till the dog gets tired of playing and stops. Whether he sits or not, she says good boy, picks him up an puts him in the car.
The reason I can more easily catch him and the method that will help you is that I often reach down and pet him, like I'm going to pick him up, then I give him a treat and let him go about his business. I do this often when I'm around him. If 9 times out of 10, you catch your dog, then let him go back to his playing, then he'll let you catch him consistently on that 10th time. On the other hand, if you snatch him up and take him inside every time you get your hands on him, then he's going to run from you. There is almost no human that can catch any dog by running them down, so you shouldn't even try. You need to entice him to come to you.
Having said that, you also need to work on his training more. From what you've said, he has what many peoples dogs have, a vague set of commands that he sort of does okay. Many of my dogs had that growing up. However, once I got older I got more serious about training my dogs. It's a lot of work and most people don't want to put it in. Sometimes they convince themselves they will when the dog is a puppy, but its much easier to do something correctly for a couple of weeks than it is to do something for the rest of the dogs life. And that's what it takes. Granted it gets easier, but you're training your animal, good or bad, every time you interact with it.
If you tell you dog not to beg for food 100 times and then on the 101rst time you give him some of your food, he'll beg constantly for weeks. The key is being consistent. Also, I know I've made it sound like a massive amount of work but it really isn't. Dogs have short attention spans and training sessions should be kept short anyway. I rarely work my dogs more than 10min at a time. However, when I've first training them, I do multiple sessions a day. Training can even be as short as a few seconds. Whenever my dogs come in the house, I walk in first, then stop with the door wide open and wait for them to stop at the door and look at me and wait for my signal to come in. My grandmother's dog I inherited was especially bad at this, since she'd always been a spoiled house dog and used to barging in and knocking people down. More than once I scooped her back onto her butt with my foot. It took her a little while, but she finally learned to wait on a signal. This literally took less than 1min each time, but it instilled basic manner and we can now leave the doors open during nice weather and not worry about a muddy dog bursting into the house.
Training can seem like a lot of work, but the benefits and lack of frustration, like that you're experiencing now, are really worth it. As for your dog, I'd suggest clicker training. There are literally hundreds, if not thousands, of sites, books, and youtube videos on it, so I won't go into it here, but it's a really good training method. You want to take the commands he already knows and improve upon them gradually. If he sits, try to get him to sit faster or straighter. One percent improvement over 100 days is 100% improvement. Even things like this will help you catch him, because the more he learns to listen when you ask, the more likely he will do it when he doesn't necessarily want to.
One piece of advice is to treat early and often when training. You aren't looking for perfection in the beginning and you don't want to frustrate your dog. Also, if your dog starts getting frustrated or shutting down, ask him to do something he's good at, reward him, then quite till you've thought about how to better get across to him what you're asking. Lastly, even when you phase out treats, you still have to treat occasionally to make it worth your dogs while.
Next, like Layna said, you can have him on a long leash till you get better control of him. If your yard is fenced in, then I would wait to work on this till a nice day. Then take a chair out under a tree, let him loose and read a book while he's running around. Anytime he comes near you, give him a piece of high value treat, like a piece of hotdog and then let him go back to playing. If you think you can get away with it, try to walk toward him and pet him, then walk back to your chair. If he dodges you and runs away, ignore him and walk a little further past him like you weren't trying to get him, then go back to your chair.
A last option that I don't recommend you introduce on your own would be an electronic collar. Many people don't like these, because they think anyone who uses one is cruelly shocking their dog. In reality, these collars have many levels of stimulation and often start with a buzz or beeping sound, then vibrate before an actual electric stimulation happens. The reason they are a good idea is for the exact issue you're having now. You're dog thinks he can get away from you an any correction you might issue, so he feels free to do what he wants. I bet he behaves fine on a leash, because he knows you can touch him or bump the leash to give a correction. A long leash is the next step to this and an electronic collar is the step after that.
Often, they're used with hunting dogs, because they get so focused on hunting that they can't even hear their trainers. I know my Jack Russell was like that. The handlers make the collars beep/buzz to ask the dog to look at them for a signal. If they ignore that, then they gradually amp up the stimulation to where the dog does acknowledge it. The dog chooses the level of stimulation that's necessary and often, the next time, they listen with less stimulation until it's never necessary to "shock" them. You also get dogs like yours and my grandmothers who just play can't catch me, can't touch me. You simply have to show them it isn't true.
Having said that, you can't just strap on an electric collar and go to town. You have to properly fit it to the dog. You also have to train them just like anything else, to associate the collar with your correction. If you're dogs running around doing something and his collar starts to beep or shock him, he'll have no idea what's causing it, much less how to respond to it. You also have to control yourself. It's easy for people to get frustrated when an animal is not doing what they feel it should. Even if you don't expect your dog to be perfect, they often do something well for several days, then all of a sudden they regress and act like they've never heard the command before. That's part of training, but it can frustrate people and you can't allow that to happen when you're using an electronic collar. The dog isn't actually doing anything wrong and using the collar to correct him is detrimental to him and his training. So if you decide to use one, I recommend you pay someone who is competent and you feel uses a collar correctly to teach you and your dog how to use one. Even some professional trainers don't use them correctly, so you should evaluate their competence yourself. I'd ask to observe a training session where they use one. Good luck with your dog. I do think the catch and release method will solve your immediate problem with the least amount of work.