Searching 就 up on the Chinese Grammar Wiki gives a pretty long list of usages, and I have no idea what (if any) is most applicable.
The sentence still makes sense, even if you remove 就.
Therefore, 就 is an adverb here, and emphasizes the verb, "sleep".
《现代汉语词典》 Page 697 shows a few examples.
Do a Search Q&A (on the upper right field) on 就 and you will find extensive discussions on this character.
Simply put: '就' in '你怎么就睡在这里了呀?' Means 'just'.
Without further context, 'just' in "Why are you just sleep here?' Can carry different meanings too. For example: 'simply; only; merely; right away; then; must' and so on. Or even as a particle for emphasis
你怎麼就睡在這裡了呀? - figuratively, "of all places, why are you sleeping here?" vs 你怎麼睡在這裡了呀? - "why are you sleeping here?"
This is a very interesting question. In this sentence, I feel it's used to convey a sentiment for emphasis, similar to: 就是啊 就是啊! vs 是啊 是啊!
In preparing my answer, I went through a google search of my own. I did find this old post, and perhaps it could be helpful to you: How is 就 (jiù) used?