Lots of beating and a few lightning strikes should set em straight :woot
But seriously, what you're describing happens to a lot of people. What's going on is, your creature's need/desire to help your people is greater than any desire to eat/sleep.
You have two approaches here, first, you can increase his desire to eat and sleep, which you need to be careful with. You don't want to make him too greedy/tired. Your creature's eating habits can be annoying to fix, it really depends what's wrong with them and trying to fix the issue might end up screwing with more variables in his mind. Obviously the best way to get a creature to eat more often is to get him to eat things.. more often (note hunger when you reward him AND when you feed him). There are a few tricks to use if your creature isn't eating at all. Make sure you do not have him on a leash, then hand him the food. If he is curious, or decides to do something else afterwards, reward him to ZERO percent. This will turn his attention to you, "Your creature wants to mess around with you." Once that happens quickly reward him to 10% and he will eat it almost every time no matter how bad of a state his mind is in. Reward at your own discretion afterwards. Things to watch out for would be, feeding him at low hunger levels, and getting him too accustomed to eating what you give him. Creatures can learn to eat things as soon as you give it to them, and they can also learn to only accept food from you, instead of getting his own.
-- As for sleeping, creatures all develop different sleeping pattens which can be VERY annoying to fix. Especially when you want them to sleep outside of the temple creature pen. Getting him to sleep while away from distractions may help. Rocks and trees that he cannot pickup will be more likely to cause your creature to sleep while leashed, but it's not certain. Teaching him to sleep too much in the pen might cause him to only ever sleep in his pen, which is annoying as heck to me, but you might want that.
Second, you may want to consider lowering your creature's desire to help your people, ESPECIALLY when he has a high hunger or tiredness. Also you can teach your creature to use miracles less, and choose to manually gather resources to save energy when he gets tired. You also have to be somewhat careful with this as you don't want him to ignore your people forever (that won't really happen), but you have to keep in mind the creature will try to choose something they think is okay. He might end up trying to kill people if you push him too far. Then when you turn around and beat him til he's bruised, he'll add that as a rebellious action to choose from.
When you get into messes like these you need to consider how you taught your creature. If you used 15 miracles in a row helping your village and raising the % your creatures knows miracles, there is a chance he learned the whole streak, or any other combination you did, so he's going to pass out before it occurs to him to shift focus. Remember that positive reinforcement works much better than negative, though you need to be very mindful of the condition your creature is in and what's happening around him at the time. You might not want your creature to refuse to water your burning buildings just because his tiredness is 65%.
Keep in mind a creature's intelligence actually has a lot to do with how you teach them outside of miracles as well. Tigers might decide to do the same thing you slapped them for five times in a row, while I had an ape that could tell he needed to cast a specific miracle if I merely charged it up in my hand and hovered around him a bit (that was freaking cool). I've noticed that the more intelligence a creature has, the more likely it will try to act rebellious from beatings so beware.