I think your questions are both OK. Your only mistake is that you mention the Present Perfect Progressive (also called the Present Perfect Continuous) but you don't use it.
When inquiring about periods of time regarding activities that still occur/are still true (and are not completed), the right approach in English is always a Present Perfect tense. Whether that be Continuous (+ing) or Simple (+ past participle) (and if the action is completed, but we don't know when), depends on the verb. State verbs (like "be" in your first example) can only be employed using Present Perfect Simple, whilst action verbs (like "study" in your second example) can be employed in PPS/PPC. Using PPC gives your sentence/question that emphasis of "repeated/continuous" activity, but is not mandatory.
So:
How long/How many years have you studied English?
Is just as worthy as:
How long/How many years have you been studying English?
(The same applies to your first example too)
Which brings us to your question of how to phrase your query if you wish to receive an answer using a specific "time reference" (ie "years" in your example). Generally speaking, the native English speaker will likely not worry about the "time" part of the question too much, leaving the listener to respond in the most logical way. In your example, this would likely be in years, or possibly:
Since I was 5.
Of course, sometimes specificity is needed or desired as in your question. If you don't want "since I was 5" type answers, then you need to "lead" the listener, by encouraging them to respond according to the "time" part of the question you use.
How many years? = For x years
How many days? = For x days
Etc.
Consider this last example of a situation where a specific (maybe overly?) response is needed.
A manager has to enter a candidate's information into the following box on their computer during a job interview: Years of higher education studies completed: [ ]
The manager will obviously require a response in years, and so will need to ask his question accordingly:
How many years of higher education studies have you completed?
Note the use of PPS for the "finished action".
Or, if the candidate is still studying:
How many years have you been studying in higher education?
Naturally, my examples work just as well with a more general "time query" (ie "How long?") if the answer doesn't need to be specific.
I hope that answers your question fairly well. Maybe I went into too much detail on PPS/PPC and confused you (I hope not!). As a final observation, I think your first question reads more naturally without "for".
There is a lot of confusion because of your example sentences, which seem to be drawing attention away from the issue you want to discuss.
Stay up is a phrasal verb that means stay awake or remain out of bed. If I say, "I stayed up until midnight last night," that essentially means "I went to bed at midnight last night," or, "I fell asleep at midnight last night."
So, the phrase stay up for work seems a little awkward. It's not something I would normally say, but I suppose I could contrive of a situation where I might say it. For example, let's say I know someone who is on call. They tell her, "You need to be ready to come into work if we call you. However, if we haven't called you by a certain time, you won't be called at all." If I don't know what that time is, and I'm curious, I could ask:
Until what time did you stay up for work last night?
meaning, what time were you able to finally go to bed?
Perhaps you meant "stay at work", which makes a lot more sense:
How late did you stay at work last night?
meaning, "What time did you finish work last night, and head home?"
If I wanted to express with one of those two dastardly prepositions (by or until), I would use until:
Until what time were you here at work last night?
Another possibility is that the person starts work at an odd time (say, 3AM). If I knew this person didn't go to sleep before starting work, I might ask:
How late did you stay up before going to work last night?
Your sentence asks about until/by + what time, but many of these questions are asked with "how long" (or "how late") instead, which is why it's hard to give you a straight answer to your question.
Here's a situation where I might use this phrasing. You and I plan to go camping this weekend. I need to get some details before we can finalize our plans. Later tonight, I'll start doing some research. That is the backdrop for this conversation:
After you figure things out, just give me a call, and let me know the plans, okay?
I can do that, but it might be kind of late before I get it figured out. Until what time can I call?
I should be up until 11; you can call me any time before then.
Sounds good.
If I haven't heard from you by that time, I'll look for a voice mail in the morning.
Until what time can I call? is asking how late it will be before it would be considered impolite to rouse you from bed with a phone call.
Best Answer
The initial preposition at in such contexts is entirely optional, but it usually wouldn't be included (although in reality we usually use when rather than [at] what time anyway :).
OP's specific example happens to include a "location-based" clause based on at [the swimming pool], but it might be worth looking at two slightly different contexts...
...and...
In my opinion, both 'b' versions above are at least slightly stilted / awkward. But whereas 1a and 1c carry the same meaning, that's not the case with the second pair. 2a (without the preposition from) is effectively asking where you ended up, not where you started from (speaker might be asking your final position in a race, for example; Where did I come [in the marathon]? I did pretty good, actually - I came third, out of 2000 runners).
The point being that because there's no credible alternative meaning in the first pair that depends on whether the preposition is included or not, it's entirely a stylistic choice (and on average we don't bother with unnecessary words). But the second example shows that we do include the preposition where it's required to avoid ambiguity.