Numerous studies have found that code-switching (and the use of more than one language in general) indicates proficiency not only in both languages but also in the subtle rules of language use in the speech community.
In short, bilinguals do not switch and mix languages because they dont know one language or the other or willy-nilly. Every careful study of such language behavior shows that it is purposeful and rule-governed.
Here are some data from northeastern China where Chinese and Korean are spoken extensively.