It comes from just doing it after a while - not sure how long it took for German to kick in for me...although my German is only on a basic level.
Do I actually think in the second language? Sometimes I do, and I think it comes from actually speaking to people in German - okay, for a lot of things, I still have to stop and think, but there's stuff I can naturally say.
For example, I went to Spain last semester, after having been to Germany the month before, I don't speak that much Spanish, I just know the gestures, yet, often or not, they'd come out German, because German is the second language that has stuck to me...in a restaurant, instead of saying 'muchos gracios' I embarrassingly said, 'vielen dank'.
I'll probably say that maybe it took a year or so. My advice is just to go around speaking it, even if it's just yourself. For example, walk into the kitchen and say to yourself, 'ich mochte kase bitte', meaning 'I would like cheese please' in German or 'ich bin mude' if you're getting tired, and you can pick it up that way.
However, yes, age is a factor too...I'm not sure if I'm more susceptible to learn German because I lived there when I was 3 years old, or it's practice or it's both. But either way, you need to be talking it in order to get the hang of it.
Anyway, in the spirit of my advice, now, darf ich toiletten gehen bitte?