When they were chicks I read up on how to free range my birds and the best tip I found (working so far!) was to keep the birds confined to the coop/pen area till they built up a habit and considered it 'home'. Then let them out in the morning and bribe with food to get them back in at night if necessary. With ours, it wasn't. they just went to bed on their own.
If time frame helps, my flock hatched in the beginning of march, in early may they moved to the pen outside, and in June we let them loose!
And, trickling in slowly, they put themselves to bed every night before the sun goes down, no bribery needed.
I love my chickens!