The pergola is much like a stick framed house--the framing itself resists vertical forces (gravity) but in and of itself, has no resistance to shear forces (side to side). For a house to stand up on its own, the sides need to be braced against shear forces...typically that's done with plywood sheathing. Barring that, diagonal bracing can be used.
On the pergola, since it's attached to the house, the house is acting as shear resistance on 3 sides of your pergola, but the front is the weak spot, as you've found out.
Some potential options:
sink the front two posts into the ground several feet and surround with concrete (typically you'd want 1/3 of the post in the ground
add diagonal bracing. 45 degrees is the strongest but for the pergola, likely not a requirement. If 45 degrees brings the braces too low, you could consider a different angle. Or make it an architectural detail...perhaps bringing the braces on the outside of the posts (extending the top beam)
metal reinforcement. Pick up some metal L-plates. The bigger the better and attach them to the post and beam.
add a railing to that side of the deck and diagonal brace that (tensioned cables, wood panels, diagonal rails, etc.)
add tensioned metal cables diagonally between the tops of the two posts. Not sure you could enough of an angle to make that work or not, though.
add diagonal bracing to the TOP of the trellis. Create a giant 'x' using wood beams or, again, possibly tensioned cables. That will transfer the horizontal shear forces on the front back to the ledger and house.
You will have to do something, though. Even a 'wiggle' of a couple of inches will cause problems over time as the wind rocks it back and forth. The hardware may not fail but eventually the wood where the hardware connects the members will fail with wear over time.
Of the options I listed, I'd probably start by getting some large L plates. It's likely the least expensive option and you can hide them fairly easy on the inside of the posts and beams. Alternatively, you might be able to use some heavy duty metal shelf brackets. As a bonus, you might find some with some architectural detail that will look nice.
PS: After re-reading your question, I have a few structural concerns:
you state your beam is a 2x6 with 2" notches. The notches means your beam is really just a 2x4. While there isn't much of a load (just the joists) a 2x4 can't really support any force without noticeable defection over time. I'd be worried that in a decent storm, there could be enough force to eventually snap it. That would be worse-case. Best case, though, I think it'll just start sagging after a season or two and look ugly. I'd consider under-mounting an un-notched 2x8 or even 2x10. As a bonus, that can help with resisting some shear force.
I can't tell if the house-side is actually connected to the house. You do have 2 posts back there so now I'm thinking this is maybe a free-standing pergola. If that is the case, then you have no shear force resistance on any of the 4 sides--so you'll need to apply whatever solution to all four sides if that is the case. [EDIT: I just saw your comment in the other answer, the back is, indeed, a ledger. So disregard this one]
you mentioned that you attached the beam to the posts with a screw. Note that a) screws have very little shear force resistance (compared to bolts, plates or even nails) and b) one screw isn't going to cut it. If it's truly being held with one screw on both ends, they could snap quite easily with minimal force. Simpson hardware and/or through- or lag- bolts should be used to make those connections.
Again, these are all assumptions so apologies if you've already accounted for those issues--but if not, please do consult local codes. I'm concerned that the structure is way under-built and a good wind storm can send large pieces of wood flying in every direction--dangerous to your home and anyone in the vicinity.