It seems there are really 2 questions here:
is completely standard. に binds to a noun and marks is as indirect object, i.e. you bought the toy to or for the/your little sister.
In the other sentence, something else is going on:
In order to become a good child, you have to get up early and go to sleep early.
The easiest way is to read this as a fixed construction ~には~ used for expressing "In order to something, you have to something / something has to happen". Note that you can't use には to mean "in order to" generally, the "have to" part needs to be there, e.g.
He got up early and went to sleep early in order to become a good child
is ungrammatical. It would have to be e.g. よい子になるために早寝早起した
A bit of background is that Japanese used to have zero-nominalization, i.e. you were able to attach case particles to verbs as is they were nouns. In modern Japanese, this is not generally felicitous, but survives in many fixed constructions.