Forty balloons in the school's colours, yellow and green, were released by some of the children.
Audrey Shephard, Mayor of Sandhurst, led the tree-planting ceremony and Marion Standing, deputy headteacher, co-ordinated a whole school sing-song.
Guests included Anita Warwick, current headteacher, Kitty Dancy, former chairman of governors, Diana Pidgeon, the current chairman of governors, Shelagh Pyle, Deputy Mayor of Bracknell Forest, Tony Ecclestone, director of education, and many former teachers and dinner ladies.
The whole school took part in the celebrations and each class had its own birthday cake.
The celebrations doubled up as an open day, with visitors looking round the school, which was decorated with old school photographs and memorabilia.
Diana Pidgeon said: "It was lovely to see people who have attended the school over the past 40 years returning for the celebration.
"It was such a beautiful day to celebrate and I feel very proud to be chairman of governors.
"Special credit must go to the headteacher, Anita Warwick, who in her five years there has pushed the school from strength to strength."
When the weather improves, the school hopes to have an aerial photograph taken of the school with the children standing in the shape of a figure 40.