In this paper, we consider the solution of optimal control problem for hyperdiffusion equation involving boundary function of continuous time variable in its cost function. A specific direct approach based on infinite series of Fourier expansion in space and temporal integration by parts for analytical solution is proposed to solve optimal boundary control for hyperdiffusion equation. The time domain is divided into number of finite subdomains and optimal function is estimated at each subdomain to obtain desired state with minimum energy. Proposed method has high flexibility so that decision makers are able to trace optimal control in a prescribed subinterval. The implementation of the theory is presented and the effectiveness of the boundary control is investigated by some numerical examples.