Hamlet's development throughout the play occurs in such a way to prepare the audience for the tragedy of the final scene. If Claudius had died in Act III, this would have diluted the tragic effect of the final scene. Furthermore, it would have robbed Hamlet's character from the opportunity of further growth and development, which ultimately makes for a more satisfying audience experience.
In Act III, Hamlet's madness is still somewhat uncertain. This is especially so in his harsh treatment of Ophelia, whom he orders to a "nunnery" for multiple times when seeing her just after his "To be or not to be" speech. His way of determining the royal couple's guilt through staging a play is however ingenious, and the audience is reassured of his underlying sanity. At this stage of the play, however, he does still prove himself to be somewhat unstable in terms of emotion, if not of rational thought. The death of Polonius shows this.
Hamlet's murder of Polonius is pivotal in Act III. The fact that it was not Claudius that is killed at this point provides the play with an escalation of tension. Hamlet is faced with several difficulties in his goal to avenge his father. His life is threatened from a variety of sources. Worse, he is indirectly responsible for Ophelia's death. The way in which he handles these events however proves his worthiness of character to the audience.
Despite Claudius and Gertrude's attempt to have him executed abroad, Hamlet manages to return to continue with his plans. This reflects on the Prince's character in two respects. First, it reiterates Hamlet's willingness to take responsibility for Polonius's death. This is a willingness that he stated right after the event in Act III, scene iv:
"I do repent: but heaven hath pleased it so,/ To punish me with this and this with me,That I must be their scourge and minister. I wil...