There are no definitive guidelines to the distinction between “at school” and “in school” because the terms are used in a different way in different English dialects (there are regional differences even among British and American dialects). The general trends are as follows:
American English
For the vast majority of Americans, “being in school” means “being a student”, and “being at school” means “currently being gone to school”, just like we would say that we are “at work”:
he is still in school = he is still a student
he is still at school = he still hasn't come back from school today
Note, however, that Americans often use “school” in this context to refer to any kind of education (not just primary and secondary school), so someone studying in college could also be referred to as being “in school”. The British, on the other hand, would likely say “at university”, and someone who is “in school” (in British English) has not started their studies at a university yet.
British English
“Being in school” means in principle the same as in American English, i.e. “being a pupil”, but it is more common to use “at school” in this context, which can mean either “being a student” or “currently being gone to school”:
he is still in school = he is still a pupil (but usually not a university student)
he is still at school = either he is still a pupil or he still hasn't come back from school
Summary
Having considered all that has been said, I believe it is advisable for an English learner to follow the “American” convention, i.e. to use “in school” for “being a student” and “at school” for physical presence at school. This will be universally understood in the US as well as in the UK, while the British convention might raise a few eyebrows in the US.
However, it is better to avoid the American way of referring to college students as being “in school” (there is nothing wrong with saying they are “in college” or “at university”), as this could lead to a misunderstanding among speakers of British English.
A few more examples of correct usage:
...
This is not all! Sign up to see the rest of this text and become part of our community of language learners.
...