I fell asleep while reading a book.

Literal

Book [object-を] read-[ongoing-contracted-てる]-[while-うちに] sleep-[regret-completion-てしまった].

~ているうちに ('while doing, during the course of doing') is a temporal construction implying something happened during the (ongoing) action. 読んでる is the casual contraction of 読んでいる. ~てしまう carries both completive ('fell fully asleep') and regret ('didn't mean to') nuances. Distinct from ~ている間に (defined interval) and ~ながら (simultaneous by same subject).