My sister sometimes wished she were a boy.

Literal

Younger-sister [topic-は] sometimes self [subject-が] boy were-[conditional-だったら] good [regret-のに] [quotative-と] was-wishing.

自分が男の子だったらいいのに — the ~たらいいのに wish structure embedded as the content of 願う ('to wish'). The と before 願う is quotative, marking the wish as the thing being wished. 時々 ('sometimes') softens it to an occasional longing.