Major Gen Sanaullah who was the General Officer, Commander Swat Division, along with Lt Col Touseef were killed when the remote-controlled Improvised Explosive Device planted along the road exploded.
They were on their way back after spending a night with troops at a forward post.
Maj Gen Sanaullah, Lt Col Tauseef, Commanding Officer 33 Baloch Regiment and Lance Naik Irfan Sattar were killed in the blast near Binshai in Upper Dir, the Inter Services Public Relations said.
The incident also comes just a day after the Khyber Pakhtunkhwa government announced gradual withdrawal of troops from Malakand division starting next month.
As per the plan, in the initial stage, security forces will be withdrawn from Buner and Shangla districts starting mid-October.