Take any train to Brasov, then get to the Autogara 2 bus station which is around 1.5km away. You can take bus 23 from outside the train station to the roundabout just outside of Autogara 2. The bus ticket costs 2 leva and can be purchased from the stands near the bus stop. Bus 23 stops on the main road, not inside the Brasov train station parking/bus area. Alternatively, if you make a right on the main road walk until it ends (about 1km) then make another right, the Autogara 2 bus station is just before the next roundabout (where Bus 23 stops); you can get there by foot in around 20 minutes. Note: If you are heading to or from the city center, Bus 12 goes to that roundabout as well... more info on Brasov's buses here.
The blue line on the map below is the Bus 23 route from the train station to the roundabout near the buses to Bran. You can see how this can easily be walked as well.
Other tips: trains that begin with "R" stop at every station and take over 3 hours to get to Brasov from Bucharest, so are best avoided. The fastest IC or InterCity trains do the same journey in around half that time and the price difference wasn't much.
Two or more people traveling together by rail in Romania get a 25% discount when the tickets are purchased together.
There is a shopping mall next to Brasov's train station if you have some time to kill waiting for your train. The top floor has a variety of places to eat/drink with some nice views of the mountains around the city, free wifi and even billiards/bowling if you are so inclined. A picture from there towards Brasov's train station is included below.
The last train out of Brasov back to Bucharest departs around 8:45pm, getting back to Bucharest just after 11pm. This matches up nicely with the overnight train to Sofia which now departs Bucharest Nord at 11:55pm.
There is a night train from Brasov to Budapest that leaves around 8pm, arriving the next day, if that's the direction you are headed.