Rocked by the train, I dozed pleasantly for about two hours.

Literal

Train [by-に] swayed-[passive-られ] [while-つつ], two-hours [approximately-ほど] good feeling [with-で] dozingly slept.

~つつ is the literary equivalent of ~ながら for simultaneous actions — it appears in written prose and formal speech but rarely in casual conversation. 揺られる is the passive of 揺る, here expressing an involuntary experience ('being rocked') rather than a true passive. うとうと is a mimetic for light, drowsy dozing — distinct from ぐっすり (deep sleep) or こっくり (nodding off). The whole scene paints a pleasant, rocking-train nap.