To answer your first question, yes, both sentences are correct. However, they do have different meanings.
The first sentence means what you think it means:
It is better to stay here than to go away.
Note that it could also mean this:
It is better to stay here than someplace else.
It really just depends upon context. The second sentence, as you said, contains a superlative, "best." In English, unlike in some other languages such as Spanish, the superlative does not require a definite article. In fact, it would actually sound weird to say, "It is the best to stay here."
The second sentence means this:
It is better to stay here than anywhere else.
That looks a lot like my second meaning for the first sentence, but here's the difference: "someplace else" in the first sentence refers to a specific other place, while "anywhere else" means any place where you could feasibly stay.