I fell asleep while I was reading the book.

Literal

Book [object-を] read-[ongoing-ている] [during-間に] slept-[regret-completion-てしまった].

~ている間に ('during the time that one is doing X') explicitly marks a temporal interval during which another event happened — often a disruptive or unintended one. 眠ってしまう ('ended up falling asleep') uses ~てしまう for the unintended/regretful sense. Compare with ~うちに, which implies a broader or less defined span than 間に's explicit interval.